/usr/share/doc/python-twisted-mail/examples/sendmail_message.py is in python-twisted-mail 17.9.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | from __future__ import print_function
from twisted.mail.smtp import sendmail
from twisted.internet.task import react
from email.mime.text import MIMEText
def main(reactor):
me = "alice@gmail.com"
to = ["bob@gmail.com", "charlie@gmail.com"]
message = MIMEText("This is my super awesome email, sent with Twisted!")
message["Subject"] = "Twisted is great!"
message["From"] = me
message["To"] = ", ".join(to)
d = sendmail("smtp.gmail.com", me, to, message,
port=587, username=me, password="*********",
requireAuthentication=True,
requireTransportSecurity=True)
d.addBoth(print)
return d
react(main)
|