[Tutor] Smtplib module
Sat, 20 Oct 2001 15:06:38 -0700
Doh! there is a mistake in the script that I noticed, right after I
clicked on "send". Read on:
On Sat, 20 Oct 2001 15:00:22 -0700, Sheila King <email@example.com>
wrote about Re: [Tutor] Smtplib module:
:message = """\
:Subject: testing smtp response
:Date: Sat, Oct 20 2001 15:00 -0700
:Here is the message body.
:SENDER = 'me@mydomain'
:RECIPIENT = 'me@mydomain'
:server = smtplib.SMTP('localhost')
:response = server.sendmail(SENDER, RECIPIENT, message)
That last line above needs to be:
I believe if you check the docs for the smtplib module, you will find
that the response that is returned is a (?) list or dictionary of the
response for each SMTP envelope recipient. Since response isn't a
string, you can't print it. However, you can convert the response to a
string, or write special code to handle the dictionary/list (whichever
it is), and parse the individual results.
For my needs, which are not that complex at the moment, I just convert
it to a string and write it to a log.