[Tutor] smtplib howto send with a subject line

Mike Hansen Mike.Hansen at atmel.com
Thu May 24 00:06:25 CEST 2007


> -----Original Message-----
> From: tutor-bounces at python.org 
> [mailto:tutor-bounces at python.org] On Behalf Of Daniel McQuay
> Sent: Wednesday, May 23, 2007 3:52 PM
> Cc: tutor at python.org
> Subject: Re: [Tutor] smtplib howto send with a subject line
> Thanks Mike, it seems that I'll be easy to incorporate that 
> into my script as well. 
> I'll give it a try. I'm still open to other suggestions, though.

Take a look at this link again(I think you said you looked at it.)


Notice that the body string has From:, To:, Subject: followed by the
from, to, and subject.

body = string.join((
    "From: %s" % FROM,
    "To: %s" % TO,
    "Subject: %s" % SUBJECT,
    BODY), "\r\n")

You might need to do something similar to get your subject line although
without the string module since the string methods are built in. 

I'm no expert on how to construct e-mail messages, so take this with a
grain of salt. I'm but a simple caveman programmer(*). 


* - Phil Hartman "I'm but a simple caveman lawyer" SNL

More information about the Tutor mailing list