kootenpv / yagmail

Send email in Python conveniently for gmail using yagmail
MIT License
2.66k stars 265 forks source link

smtplib.SMTPAuthenticationError, Unrecognized command, gsmtp #26

Closed schef closed 8 years ago

schef commented 8 years ago
Python 3.5.0 (default, Sep 20 2015, 11:28:25) 
[GCC 5.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import yagmail
>>> yag = yagmail.SMTP('mymail', 'pass')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.5/site-packages/yagmail/yagmail.py", line 68, in __init__
    self.login(password)
  File "/usr/lib/python3.5/site-packages/yagmail/yagmail.py", line 179, in login
    self.smtp.login(self.user, password)
  File "/usr/lib/python3.5/smtplib.py", line 730, in login
    raise last_exception
  File "/usr/lib/python3.5/smtplib.py", line 721, in login
    initial_response_ok=initial_response_ok)
  File "/usr/lib/python3.5/smtplib.py", line 627, in auth
    initial_response = (authobject() if initial_response_ok else None)
  File "/usr/lib/python3.5/smtplib.py", line 664, in auth_login
    raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (502, b'5.5.1 Unrecognized command. s189sm27502265wmf.16 - gsmtp')
>>> 
schef commented 8 years ago

I issued this problem also on other python3 gmail examples. And i did get "Sign-in attempt prevented" from google.

schef commented 8 years ago

Ok. Login with your gmail account and find "Allow less secure apps:" from https://myaccount.google.com/security#activity