Subject with SMTPLIB?

Gregory Jorgensen gregj at pobox.com
Tue Mar 13 04:35:42 EST 2001


You need to add a subject header to your message. Email message format is
simple: headers, blank line, message body.

import smtplib

msg = "subject: hello, world!\n\nmessage body"

s = smtplib.SMTP(host)
s.sendmail(fromaddr, toaddrs, msg)

You'll find a good SMTP quick reference on Dan Bernstein's site (he's the author
of qmail). See http://cr.yp.to/immhf.html.


In article <3AADE48A.5D8AA43 at daimlerchrysler.com>, root says...
>
>Hello!
>
>I need to write some mail for my fax-log evaluating script. I'm
>currently using
>the smtplib to simply send some mails. But how can I get (without
>studying RFCs
>and papers on SMTP for years)  a SUBJECT for my mails? It must be
>this easy, but the library reference in the python documentation package
>tells
>me nothing about it.  I was disappointed that the documentation on the
>smtplib
>module didn't tell me that.

Greg Jorgensen
Deschooling Society
Portland, Oregon, USA
gregj at pobox.com



More information about the Python-list mailing list