help using smtplib to work ..
Jordan
jordan.taylor2 at gmail.com
Wed Nov 8 22:45:00 EST 2006
Your post was definitely the most helpful for me. For some reason,
smtp for gmail seems to require that you call server.ehlo() a second
time, after having called server.starttls(), otherwise, the server
won't accept authorization. Thanks.
-Jordan
Gabriel Genellina wrote:
> At Wednesday 8/11/2006 19:23, NicolasG wrote:
>
> >I'm using the following code to send e-mail through python:
> >
> >import smtplib
> >
> >fromaddr = 'myMail at gmail.com'
> >toaddrs = 'myOtherMail at gmail.com'
> >subject = 'someting for subject !'
> >
> >msg = 'This is body of the mail.'
> >
> >msg = 'From: ' + fromaddr + '\nTo: ' + toaddrs + '\nSubject:' + subject
> >+ '\n\n' + msg
> >print "Message length is " + repr(len(msg))
> >
> >server = smtplib.SMTP('smtp.gmail.com')
> >server.set_debuglevel(1)
> >server.sendmail(fromaddr, toaddrs, msg)
> >server.quit()
> >
> >send: 'mail FROM:<myMail at gmail.com> size=106\r\n'
> >reply: '530 5.7.0 Must issue a STARTTLS command first
> >s1sm7666914uge\r\n'
> >
> >What am I doing wrong ?
>
> gmail.com requires authentication before sending mail. Try this
> sequence: ehlo, starttls, ehlo (again!), login, sendmail, quit
> (BTW, you need a space after Subject:, and all \n should be \r\n)
>
>
> --
> Gabriel Genellina
> Softlab SRL
>
> __________________________________________________
> Correo Yahoo!
> Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
> ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
More information about the Python-list
mailing list