I figured this one out in case anyone else makes a rookie mistake like me. I was naming my files so I could go back and review them when I started building something real, so I had named the email lesson email.py. I guess by naming the file that, I broke how the default import worked. I did the same thing with datetime as well, which is how I figured it out.
In my case, i get the error with the login methode:
Traceback (most recent call last):
File “c:\Dev\Programming\Python\Complete Python Mastery\8. Library.py”, line 296, in
smtp.login(“tugrularslan1987@gmail.com”, “hamburgistanbul”)
File “C:\Users\Tugrul\AppData\Local\Programs\Python\Python311\Lib\smtplib.py”, line 750, in login
raise last_exception
File “C:\Users\Tugrul\AppData\Local\Programs\Python\Python311\Lib\smtplib.py”, line 739, in login
(code, resp) = self.auth(
^^^^^^^^^^
File “C:\Users\Tugrul\AppData\Local\Programs\Python\Python311\Lib\smtplib.py”, line 662, in auth
raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (534, b’5.7.9 Application-specific password required. Learn more at\n5.7.9 Sign in with app passwords - Google Account Help qc8-20020a170906d8a800b00989828a42e8sm1012488ejb.154 - gsmtp’)
I used the same credential to login via gmail account.
Have anyone a solution for that?
I think i found the problem. I have activity in my google mail prvoder the 2-factor authefication. And therefore is my python script run to an error. I try just then with my another email provider(strato) and it’s work. Maybe, anyone have a soulution with the google provider and the 2-f-autenification