At Wednesday 8/11/2006 19:23, NicolasG wrote:
I'm using the following code to send e-mail through python:
import smtplib
fromaddr = '[EMAIL PROTECTED]'
toaddrs = '[EMAIL PROTECTED]'
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:<[EMAIL PROTECTED]> 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
--
http://mail.python.org/mailman/listinfo/python-list