Created
July 4, 2014 05:12
-
-
Save hideaki-t/c8a922f2a5b1f98a8bc5 to your computer and use it in GitHub Desktop.
Revisions
-
hideaki-t created this gist
Jul 4, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ import sys from outbox import Outbox, Email, Attachment from pathlib import Path if sys.version_info.major < 3: d = sys.getfilesystemencoding() def u(s): return unicode(s, d) else: def u(s): return s server_cfg = { 'username': 'username', 'password': 'password', 'server': 'smtp_server', 'port': '465', 'mode': 'SSL', 'debug': True } mail_cfg = { 'recipients': ['[email protected]'], 'subject': 'send to kindle', 'body': 'Hello', 'fields': {'From': '[email protected]'}, 'rfc2231': False } attachments = [ Attachment(u(path.name), fileobj=path.open('rb')) for path in (Path(x) for x in sys.argv[1:]) ] Outbox(**server_cfg).send(Email(**mail_cfg), attachments=attachments)