I'm trying to send an email from a mail.com account to the same mail.com account with this code:
import smtplib
USER = "EMAIL@MAIL.COM"
PASS = "PASSWORD"
data = "TEST 123"
s = smtplib.SMTP_SSL('smtp.mail.com',587)
s.login(USER, PASS)
s.sendmail(USER, USER,data)
s.quit()
I'm getting this error:
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1051)
All I need to do is send an email from either gmail.com
, mail.com
or outlook.com
; I'm trying to send either a text file or just a body of text.
I've tried many solutions from other posts but could not get it working.
I guess it's because you are using smtplib.SMTP_SSL
and using port 587
. Try changing the port to 465
. Then it should work.
Learn more about it, here. And here's a related question for reference.