[Tutor] How to send an email using Python
Samuel Avinash
samuelavinash at in.com
Tue Mar 10 12:11:28 CET 2009
Hi, Can anybody tell me how to send an email to a recipient using PythonI am trying to send an email using GmailI create an instance of smtplib and use :x=smtplib.SMTP(sever,port) and then x.login(user,pwd)I try to send the email usingx..sendmail(SENDER, RECIPIENTS, msg)But I get the following errorTraceback (most recent call last):File "C:UsersAvisDesktopMail.py", line 13, in session = smtplib.SMTP(smtpserver,port)File "C:Python26libsmtplib.py", line 239, in init(code, msg) = self.connect(host, port)File "C:Python26libsmtplib.py", line 295, in connectself.sock = self.getsocket(host, port, self.timeout)File "C:Python26libsmtplib.py", line 273, in getsocketreturn socket.createconnection((port, host), timeout)File "C:Python26libsocket.py", line 498, in createconnectionfor res in getaddrinfo(host, port, 0, SOCKSTREAM):socket.gaierror: [Errno 11001] getaddrinfo failedThis is in Windows Vista and I am trying to connect to "smtp.gmail.com" with port 465
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090310/4d676952/attachment.htm>
More information about the Tutor
mailing list