Marco Petersen wrote:
I'm using Python 2.5.4. I wanted to try out the SMTP module. I tried to send an email through my Gmail account but it keeps saying that the connection was refused.This is the code that I used : import smtplib msg = 'Test' server = smtplib.SMTP('smtp.gmail.com') server.set_debuglevel(1) server.ehlo() server.starttls() server.ehlo() server.login('[email protected]', 'password')server.sendmail('[email protected]', '[email protected]', msg)server.close() This error message keeps coming up: Traceback (most recent call last): File "C:/Python25/send_mail.py", line 5, in <module> server = smtplib.SMTP('smtp.gmail.com') File "C:\Python25\Lib\smtplib.py", line 244, in __init__ (code, msg) = self.connect(host, port) File "C:\Python25\Lib\smtplib.py", line 310, in connect raise socket.error, msg error: (10061, 'Connection refused') Can anyone help me with this?
I must admit that I know nothing of the SMTP module, but I do know that with gmail you need to use an SSL secure connection on port 995.
I doesn't seem to be aplied in your script as far as I can tell. Best Regards Ole _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
