asssaf / gmail-relay Goto Github PK
View Code? Open in Web Editor NEWSimple MTA that uses gmail API using a client OAuth token to send mail
License: MIT License
Simple MTA that uses gmail API using a client OAuth token to send mail
License: MIT License
Hey there,
I've been playing around with this, but haven't been able to get anything to send. I got the authentication part done, but am having issues with the actual message. my "test" file looks like this:
([email protected] is substituted for the actual username that was authenticated)
x-sender: [email protected]
x-receiver: [email protected]
from: MyName [email protected]
to: You [email protected]
Subject: Testing Subject
Hey, did you know that this works?
.
The error I'm getting:
(venv) [root@localhost venv]# cat ../test | ./gmail-relay.py Traceback (most recent call last): File "./gmail-relay.py", line 117, in <module> main() File "./gmail-relay.py", line 110, in main sent = send_message(service, "me", message) File "./gmail-relay.py", line 68, in send_message message = (service.users().messages().send(userId=user_id, body=message) File "/root/venv/lib/python3.4/site-packages/apiclient/discovery.py", line 642, in method actual_path_params, actual_query_params, body_value) File "/root/venv/lib/python3.4/site-packages/apiclient/model.py", line 149, in request body_value = self.serialize(body_value) File "/root/venv/lib/python3.4/site-packages/apiclient/model.py", line 258, in serialize return simplejson.dumps(body_value) File "/usr/lib64/python3.4/json/__init__.py", line 230, in dumps return _default_encoder.encode(obj) File "/usr/lib64/python3.4/json/encoder.py", line 192, in encode chunks = self.iterencode(o, _one_shot=True) File "/usr/lib64/python3.4/json/encoder.py", line 250, in iterencode return _iterencode(o, 0) File "/usr/lib64/python3.4/json/encoder.py", line 173, in default raise TypeError(repr(o) + " is not JSON serializable") TypeError: b'eC1zZW5kZXI6IHRlZGRqb2huc29uQGdtYWlsLmNvbQp4LXJlY2VpdmVyOiB0ZWRkam9obnNvbjk5QHlhaG9vLmNvbQpGcm9tOiBNeXNlbGYgUGVyc29uYWxseSA8dGVkZGpvaG5zb25AZ21haWwuY29tPgpUbzogWW91IDx0ZWRkam9obnNvbjk5QHlhaG9vLmNvbT4KU3ViamVjdDogSSBsb3ZlIGl0CkhleSwgZGlkIHlvdSBrbm93IHRoYXQKLgo=' is not JSON serializable
I'm thinking the issue is either because my test input file is not formatted correctly (RFC 2822) or maybe because I'm using python 3 instead of 2?
Any help would be appreciated, thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.