I am using this piece of code:
import smtplib
fromaddr = '[email protected]'
toaddrs = '[email protected]'
msg = 'There was a terrible error that occured and I wanted you to know!'
# Credentials (if needed)
username = 'myusername'
password = 'passwd'
# The actual mail send
server = smtplib.SMTP_SSL('smtp.gmail.com',465)
server.ehlo()
server.starttls()
server.login(username,password)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
I am receiving this error:
Traceback (most recent call last): File "C:/Python34/sendemail.py", line 15, in server.starttls() File "C:\Python34\lib\smtplib.py", line 673, in starttls raise SMTPException("STARTTLS extension not supported by server.") smtplib.SMTPException: STARTTLS extension not supported by server.
When I do exculde server.starttls() I am receiving different error message about authentication. I have another price of code when I am accessing Gmail via web browser using webdriver and credentials works, so I copied and pasted to this code to make sure that credentials are correct.
I can't figure out why this is not working.
Thanks in advance.
you'll have to see here as well
use port 587
server=smtplib.SMTP('smtp.gmail.com',587)
server.starttls()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With