[Tutor] SMTP Module Help

Kent Johnson kent37 at tds.net
Wed Jan 7 12:54:56 CET 2009


On Tue, Jan 6, 2009 at 4:45 AM, Marco Petersen
<marco.m.petersen at gmail.com> 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')

>From the docs here
http://mail.google.com/support/bin/answer.py?answer=77662
Google SMTP uses port 587, not the standard SMTP port 25. Try
  server = smtplib.SMTP('smtp.gmail.com', 587)

Kent


More information about the Tutor mailing list