Well, login plain did the job:
 
session = smtplib.SMTP(smtpserver)
session.ehlo()
session.esmtp_features["auth"] = "LOGIN PLAIN"if AUTHREQUIRED:
   session.login(smtpuser, smtppass)

 
// Naderan *Mahmood;




________________________________
From: Mahmood Naderan <nt_mahm...@yahoo.com>
To: python mailing list <python-list@python.org>
Sent: Fri, August 20, 2010 6:13:20 PM
Subject: Get authentication error while using 'smtplib'


I have this script to send an email via SMTP:
import smtplib
smtpserver = 'smtp.server.com'
AUTHREQUIRED = 1# if you need to use SMTP AUTH set to 1
smtpuser = "username"# for SMTP AUTH, set SMTP username here
smtppass = "password"# for SMTP AUTH, set SMTP password here
RECIPIENTS ='recipi...@server.com'
SENDER = 'sen...@server.com'
mssg = open('filename.txt', 'r').read()
session = smtplib.SMTP(smtpserver)
if AUTHREQUIRED:
   session.login(smtpuser, smtppass)
smtpresult = session.sendmail(SENDER, RECIPIENTS, mssg)
After running the script I get this error:
 
Traceback (most recent call last):
  File "my_mail.py", line 14, in <module>
    session.login(smtpuser, smtppass)
  File "/usr/lib/python2.6/smtplib.py", line 589, in login
    raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (535, '5.7.0 Error: authentication failed: 
authentication failure')

However there is no problem with my user/pass because I can login to my mail 
account.

Thanks for any idea. 
// Naderan *Mahmood; 


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to