Hello,

i am trying to send emails through a python script , but it complains that

socket error 10061 conection refused..
any help with this would be great...


import smtplib

smtpserver = 'mailserver'
AUTHREQUIRED = 1 # if you need to use SMTP AUTH set to 1
smtpuser = '#####'  # for SMTP AUTH, set SMTP username here
smtppass = '#####'  # for SMTP AUTH, set SMTP password here

flname = 'c:\\Python24\\mssg.txt'
#c:\\tst.txt

RECIPIENTS = ['[EMAIL PROTECTED]']
SENDER = '[EMAIL PROTECTED]'
mssg = open(flname , 'r').read()

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


Find your next car at Yahoo! Canada Autos
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to