[Tutor] Sending Mail
Kent Johnson
kent37 at tds.net
Tue Apr 22 14:36:29 CEST 2008
On Tue, Apr 22, 2008 at 6:06 AM, Stephen Nelson-Smith <sanelson at gmail.com>
wrote:
> smtpserver = 'relay.clara.net'
>
> RECIPIENTS = ['sanelson at gmail.com']
> SENDER = 'alerts at atalanta-systems.com'
> message = """Subject: HTTPD ALERT: %s requests %s connections
> Please investigate ASAP.""" % (rps, connections)
>
> This sends emails....
>
> But gmail says it came from "unknown sender"
You have to include the From and To headers in the message body as well as
passing them to sendmail(). See the example here:
http://docs.python.org/lib/SMTP-example.html
Kent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080422/79f25069/attachment.htm>
More information about the Tutor
mailing list