[Tutor] sending mails from python

euoar euoar at yahoo.es
Sat Oct 21 12:45:47 CEST 2006


I'm trying to learn how to send e-mails with python. But I always become 
this error: socket.error: (110, 'Connection timed out'). Is there 
something bad in the code? Does anyone knows what could be wrong? I'm 
using python from linux, and have no proxy...

The code that I use is this (of course, filling with my persona data the 
" "):

import smtplib

smtpserver = 'my smtp server goes here'
AUTHREQUIRED = 1
smtpuser = 'my user name'
smtppass = 'my password'

RECIPIENTS = ['the recipients']
SENDER = 'my mail'
mssg = "una prueba desde python"

session = smtplib.SMTP(smtpserver)
if AUTHREQUIRED:
    session.login(smtpuser, smtppass)
smtpresult = session.sendmail(SENDER, RECIPIENTS, mssg)

if smtpresult:
    errstr = ""
    for recip in smtpresult.keys():
        errstr = """Could not delivery mail to: %s

Server said: %s
%s

%s""" % (recip, smtpresult[recip][0], smtpresult[recip][1], errstr)
    raise smtplib.SMTPException, errstr



Thank you for your help



	
	
		
______________________________________________ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 
http://es.voice.yahoo.com


More information about the Tutor mailing list