How to send mail with Python -
i trying send simple mail python
import smtplib server = smtplib.smtp('smtp.gmail.com', 587) server.ehlo() server.starttls() server.login("mymail@gmail.com", "mypassword") msg = "hello world" server.sendmail("mymail@gmail.com", "mymail@gmail.com", msg) server.quit() but err:
server.login("user@gmail.com", "psw") file "c:\python\lib\smtplib.py", line 652, in login raise smtpauthenticationerror(code, resp) smtplib.smtpauthenticationerror: (534, b'5.7.14 <https://accounts.google.com/continuesignin?sarp=1&scc=1&plt=akgnsbuxb\n5.7.14 4i2u8qu8v3jgf6ugv8da1ragpjyctrvify_kjai6akvx_b6qvhoz_dzfpvfpc18h-jem6k\n5.7.14 cnm2hvuq-wr-uw59hd31ms-cxmmnzuq6z3_lidadmu8_uqaiuwr4fuiux2i5ppdqjjzfvv\n5.7.14 4vref5xt4ol2in17gnb_jitpwzsjh9ox3ncncfl7srihr5m7esc15pwi0cg_2ctlyh7rxw\n5.7.14 xhojpajs8gmd-khoqwuqucywfrfo> please log in via web browser and\n5.7.14 try again.\n5.7.14 learn more at\n5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 ef10sm13614207wjd.49 - gsmtp') what should do?
thanks
it seems if require google calls app password.
basically, generate 16 digit password, unique app. enter specific password in python program, instead of password regularly use log google account.
this allows still enjoy benefits of 2-step verification while being able use third party applications, such own python program.
here instructions google on how generate such app password: https://support.google.com/accounts/answer/185833?hl=en
Comments
Post a Comment