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_kastur i@satyam.com'
toAddress = 'sridhar_kastur i@satyam.com'
msg = "Subject: Hello\n\nThis is the body of the message."
import smtplib
server = smtplib.SMTP("h stmsg002",25)
server.sendmail (fromAddress, toAddress, msg)
error:
Traceback (most recent call last):
File
"C:\sridhar\Beg inning_Python\B eginning_Python \Chapter16\tryi tout\InitialMai lExample.py",
line 5, in ?
server = smtplib.SMTP("h stmsg002",25)
File "C:\Python24\li b\smtplib.py", line 244, in __init__
(code, msg) = self.connect(ho st, port)
File "C:\Python24\li b\smtplib.py", line 307, in connect
(code, msg) = self.getreply()
File "C:\Python24\li b\smtplib.py", line 351, in getreply
raise SMTPServerDisco nnected("Connec tion unexpectedly closed")
SMTPServerDisco nnected: Connection unexpectedly closed
with that can i send an email using python?
if iam using the following code iam getting error
fromAddress = 'sridhar_kastur i@satyam.com'
toAddress = 'sridhar_kastur i@satyam.com'
msg = "Subject: Hello\n\nThis is the body of the message."
import smtplib
server = smtplib.SMTP("h stmsg002",25)
server.sendmail (fromAddress, toAddress, msg)
error:
Traceback (most recent call last):
File
"C:\sridhar\Beg inning_Python\B eginning_Python \Chapter16\tryi tout\InitialMai lExample.py",
line 5, in ?
server = smtplib.SMTP("h stmsg002",25)
File "C:\Python24\li b\smtplib.py", line 244, in __init__
(code, msg) = self.connect(ho st, port)
File "C:\Python24\li b\smtplib.py", line 307, in connect
(code, msg) = self.getreply()
File "C:\Python24\li b\smtplib.py", line 351, in getreply
raise SMTPServerDisco nnected("Connec tion unexpectedly closed")
SMTPServerDisco nnected: Connection unexpectedly closed
Comment