A2 Hosting Forums

Full Version: Sending an email from a python script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a python script I want to run as a cron job. It needs to send a report via email to several addresses. Here is the relevant snippet of code:

==========================
pysmtp = smtplib.SMTP("mail.mydomain.net")
pysmtp.set_debuglevel(1) # trying to see what's goin' on

#pysmtp.ehlo()
#pysmtp.starttls()
pysmtp.ehlo()

pysmtp.docmd("AUTH PLAIN", base64.b64encode("\x00user@mydomain.net\x00password"))

#fails here ----> reply: retcode (535); Msg: Incorrect authentication data

#and this, of course, also fails
errDict = pysmtp.sendmail("user@mydomain.net", sendaddr, msg.as_string())

==========================

I've tried it both with and without starttls. Same result.

Could someone hit me with a cluestick? Is there something I need to do to set up a user to be able to send mail?

Regards
Sorted.

The password was frelled. I generated a new one _without symbols_ and the above code works.
Reference URL's