Forums

smtplib.SMTPNotSupportedError: STARTTLS extension not supported by server.

Good day. I was using flask_mail some months ago and it was working perfectly. But I tested it yesterday and it shows the following error: "STARTTLS extension not supported by server.")

smtplib.SMTPNotSupportedError: STARTTLS extension not supported by server.

I am defining the data likethis:

app.config['MAIL_SERVER'] = 'smtp.gmail.com'
app.config['MAIL_PORT'] = 465
app.config['MAIL_USE_TLS'] = True
app.config['MAIL_USE_SSL'] = True

Can you help me please?

[edited by admin: code formatting]

Maybe you need to enable less secure apps at your Google account? (Take a look at the Gmail section of this help page https://help.pythonanywhere.com/pages/SMTPForFreeUsers . )

Please remove app.config['MAIL_USE_TLS'] = True

That is normally needed for Gmail's SMTP servers.

Hi, is it also possible with Outlook/Hotmails SMTP servers?

smtplib.SMTP('SMTP.office365.com', 587)

Restrictions for internet access are only for free accounts, paying accounts are not restricted.