I'm getting a strange error when I send email through Python using SMTP.
I get an email from Mail Delivery System in my GoDaddy inbox with the error:
[Return Code 550] sid: Xtpe1o00e3l0Tyx01 :: 5.7.1 more information. ye4si18523263pbb.103 - gsmtp
For reference, the script looks like:
import smtplib
server = smtplib.SMTP_SSL('smtpout.secureserver.net', 465)
print("Logging in: ")
server.login("username", "password")
subject = "This is a test email!"
msg = "Sample email message"
text = 'Subject: %s\n\n%s' % (subject, msg)
fromaddr = "fromemail"
toaddr = "toemail"
print("Sending email...")
server.sendmail(fromaddr, toaddr, text)
server.quit()
But I believe my error has nothing to do with the code, but with Google blocking the email.
Warning: Wild guess from incomplete data
Your email is being rejected as spam. Ensure your email is RFC2822-compliant. Quoting the standard:
In your case, add at least
From:
andTo:
to your outgoing email:and confirm that smtplib automatically adds the
Date:
field.