So I eventually got to sending mail with python.
Some articles, trying and google led me to this script:
import smtplib
import time
date = time.ctime(time.time( ))
>From = '[EMAIL PROTECTED]'
To = ['[EMAIL PROTECTED]', '[EMAIL PROTECTED]']
Subj = 'Hi'
text = ('From: %s\nTo: %s\nDate: %s\nSubject: %s\n\n'
% (From, ';'.join(To), date, Subj))
s = smtplib.SMTP('smtp.gmail.com')
s.set_debuglevel(1)
s.ehlo()
s.starttls()
s.ehlo()
s.login('foo', 'bar')
s.sendmail(From, To, text)
s.close()
So, if there's someone who really knows this stuff in the neighborhood
I'd like to ask a couple of questions.
What is ehlo and why do I have to call it twice? And set_debuglevel?
If I where to connect through other smtp server the sequence would be
the exactly the same, say yahoo or hotmail?
Are From: To: Date: and Subject: mandatory in the contents of the
email(text)? Do I have to put "real" address in From when calling
sendmail()? And in the contents?
Ok, if someone can answer these I'll be grateful.
TIA
Ricardo
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor