sending emails using python

Steve Holden steve at holdenweb.com
Thu Sep 7 06:25:23 EDT 2006


Max M wrote:
> sridhar wrote:
> 
>>iam having user account on an exchangeserver.
>>with that can i send an email using python?
>>
>>if iam using the following code iam getting error
>>
>>
>>fromAddress = 'sridhar_kasturi at satyam.com'
>>toAddress = 'sridhar_kasturi at satyam.com'
>>msg = "Subject: Hello\n\nThis is the body of the message."
>>import smtplib
>>server = smtplib.SMTP("hstmsg002",25)
>>server.sendmail(fromAddress, toAddress, msg)
> 
> 
> 
> Do yourself a favor and use the email module to construct your messages 
> with. Constructing messages by hand can lead you into so many traps. 
> Especially if you are using international characters in you messages.
> 
> 
Good advice. However, since the error is occurring in the SMTP() call a 
malformed message is clearly not the cause of this particular problem.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list