Subject line with smtplib.sendmail()

Boudreau, Emile Emile.Boudreau at
Tue Mar 20 19:18:01 CET 2007

Sorry folks. Scrape the last one that I sent. I noticed that it sends
the email perfectly if the code is not in any of my methods but the
second I insert it into a method I get the ugly email that I described
in my last email. 

Does anyone know how I can get this code in my method so that I have
access to all the variables I have?


Emile Boudreau

-----Original Message-----
From: at
[ at] On
Behalf Of Boudreau, Emile
Sent: Tuesday, March 20, 2007 1:51 PM
To: python-list at
Subject: RE: Subject line with smtplib.sendmail()

Thanks for the reply. When I use the instruction from that list this is
the email I receive. I'm using Outlook.

Working.on at
	From: Working.On at
	To: Emile.Boudreau at
	Subject: Hello!

	This Still DOESN't Work!!!!!!!!!!!!
It's just adding the "From" "To" "Subject" in the message itself. I want
to have each field at the correct place and then just the msg in the

Any Help?? Thanks

Emile Boudreau

-----Original Message-----
From: at
[ at] On
Behalf Of Fredrik Lundh
Sent: Tuesday, March 20, 2007 11:08 AM
To: python-list at
Subject: Re: Subject line with smtplib.sendmail()

Boudreau, Emile wrote:

> I'm trying to send mail from my server to my machine with test 
> results. I can send the email no problem however, the email doesn't 
> contain a "recipient list" or a "subject line". I was wondering how 
> would I go about getting the information on the actual "To" and 
> "Subject" lines so that I know to whom the email was sent and the 
> subject line without opening the email?

you have to add the headers yourself.  see the example in the library
reference, or this FAQ entry:


     This message may contain privileged and/or confidential
information.  If you have received this e-mail in error or are not the
intended recipient, you may not use, copy, disseminate or distribute it;
do not open any attachments, delete it immediately from your system and
notify the sender promptly by e-mail that you have done so.  Thank you.

More information about the Python-list mailing list