Thursday 15 July 2010

smtplib - SMTPAuthenticationError when sending mail using gmail and python -



smtplib - SMTPAuthenticationError when sending mail using gmail and python -

this question has reply here:

how send email gmail provider using python? 9 answers

when seek send mail service using gmail , python error occurred type of question in site doesn't help me

gmail_user = "me@gmail.com" gmail_pwd = "password" = 'friend@gmail.com' subject = "testing sending using gmail" text = "testing sending mail service using gmail servers" server = smtplib.smtp('smtp.gmail.com', 587) server.ehlo() server.starttls() server.login(gmail_user, gmail_pwd) body = '\r\n'.join(['to: %s' % to, 'from: %s' % gmail_user, 'subject: %s' % subject, '', text]) server.sendmail(gmail_user, [to], body) print ('email sent')

error:

server.login(gmail_user, gmail_pwd) file "/usr/lib/python3.4/smtplib.py", line 639, in login raise smtpauthenticationerror(code, resp) smtplib.smtpauthenticationerror: (534, b'5.7.14 <https://accounts.google.com/continuesignin?sarp=1&scc=1&plt=akgnsbtl1\n5.7.14 li2yir27tqbrfvc02czpqzocqope_oqbuldzfql-msifsxobctq7tpwnbxioaaqopul9ge\n5.7.14 bugbioqhtepqjfb02d_l6rrdduhsxv26s_ztg_jyyavkrqgs85it1xzywtbwire8oivqkf\n5.7.14 xxtt7enlzts0xyqnc1u4_morbvw8pgynyeegkknknyxce76jrsdne1jgsqzr3pr47bl-kc\n5.7.14 xifnwxg> please log in via web browser , seek again.\n5.7.14 larn more at\n5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 fl15sm17237099pdb.92 - gsmtp')

your code looks correct. seek logging in through browser , if able access business relationship come , seek code again. create sure have typed username , password correct

edit: google blocks sign-in attempts apps not utilize modern security standards (mentioned on back upwards page). can however, turn on/off safety feature going link below:

go link , select turn on https://www.google.com/settings/security/lesssecureapps

python smtplib

No comments:

Post a Comment