I have an error I do not understand using smtplib. I'm on windows 10, and in the cmd window I have set :
set MAIL_SERVER=smtp.googlemail.com
set MAIL_PORT=587
set MAIL_USE_TLS=1
set MAIL_USERNAME='my-gmail-username'
set MAIL_PASSWORD='my-gmail-password'
In Python 3.6 I'm doing the following :
from flask_mail import Message
from app import mail
msg = Message('test subject', sender='my-gmail-adress',recipients=['my-gmail-adress'])
msg.body = 'text body'
msg.html = '<h1>HTML body</h1>'
mail.send(msg)
I get the following error in the console : "... File "...\Python\Python36-32\lib\smtplib.py", line 254, in _init__ raise SMTPConnecterror(code, msg) smtplib.SMTPConnectError: (421, b'Cannot connect server 2a00:1450:400c:c04::10 (2a00:1450:400c:c04::10:587), connect error 10060')
Note : i have authorized gmail to use "less secure apps" as needed.
Thanks a lot for your help !