sending emails using python
maxm at mxm.dk
Thu Sep 7 12:15:06 CEST 2006
> 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.
hilsen/regards Max M, Denmark
IT's Mad Science
Phone: +45 66 11 84 94
Mobile: +45 29 93 42 96
More information about the Python-list