jose at pahv.xerox.com
Fri Mar 10 19:07:08 CET 2000
This is a code fragment we use:
to = 'somebody at wherever.com'
sender = 'jose at pahv.xerox.com'
test_msg = 'Subject: DocuShare Mail Check\n\nA test message from the
DocuShare subscription service.\n'
port = 25 # optional param, 25 is default
gateway = 'mailhost.wherever.com'
mailer = smtplib.SMTP(gateway, port)
mailer.sendmail(sender, [to], test_msg)
Which results in the following message:
From: jose at pahv.xerox.com [mailto:jose at pahv.xerox.com]
Subject: DocuShare Mail Check
A test message from the DocuShare subscription service.
I don't know why no To: field shows up, but it does arrive at the to
> -----Original Message-----
> From: David Boddie [mailto:davidb at dcs.st-and.ac.uk]
> Sent: Friday, March 10, 2000 9:12 AM
> To: python-list at python.org
> Subject: Re: Using smtplib
> On Fri, 10 Mar 2000, Pieter Claerhout wrote:
> > does anyone has an example on how to send an email using the
> > smtplib? I'm able to send an email, but I can't figure out how to
> > fill in the from, subject and to fields.
> The documentation for this module contains an example:
When reading e-mail which was sent by this example, only the "From:" and
"Date:" headers seem to be generated. As far as I can tell, if you want
"To:" and "Subject:" headers to appear in the e-mail then you have to
include them in the message body. The manual suggests that you also
include the "From:" header as well.
Hope this helps,
Solar MHD Theory Group, St Andrews
More information about the Python-list