Hi! I made a copy of the source you posted. I just got a problem as expected when doing the session.login() because the access-data is invalid. The connection via the smtplib.SMTP() could be established.
Perhaps there is something wrong with your namelookup. Can you try a call in the interactive environment for socket.gethostname() or socket.gethostbyname( socket.gethostname() ) Can you resolve the hostname "smtp.mail.yahoo.com" on a commandline? e.g. nslookup smtp.mail.yahoo.com ? Hope this can help you Ewald Intercodes wrote: > > Hello everyone, > > I am working with a registration system for my website in mod_python. I > needed to send mail to registered users for confirmation. Since I can't > use my ISP's smtp server, I used yahoo's smtp server and my yahoo > username and password to connect and send mail using this script (see > below). But I get the following error. > > "Traceback (most recent call last): > File "mail.py", line 12, in ? > session = smtplib.SMTP(smtpserver) > File "/usr/lib/python2.4/smtplib.py", line 255, in __init__ > addr = socket.gethostbyname(socket.gethostname()) > socket.gaierror: (-2, 'Name or service not known') > " > > I got this script from some website I can't remember and just changed > some values to get it to work. Is is possible to send mail like this? Is > there any other easy way to do this? > > Thanks for your time. > --------------------------- > > import smtplib > > smtpserver = 'smtp.mail.yahoo.com <http://smtp.mail.yahoo.com>' > AUTHREQUIRED = 1 > smtpuser = > '[EMAIL PROTECTED]' // > smtppass = '[snip]' > > RECIPIENTS = ['[EMAIL PROTECTED]'] > SENDER = '[EMAIL PROTECTED]' > mssg = "mod python" > > session = smtplib.SMTP(smtpserver) > *if* AUTHREQUIRED: > session.login(smtpuser, smtppass) > smtpresult = session.sendmail(SENDER, RECIPIENTS, mssg)** > > > -- > Intercodes > > > ------------------------------------------------------------------------ > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor