4

The following code works with another gmail account of mine, but fails with the account im now using, I've already set up POP3 for both accounts!

import email, poplib
from email.header import decode_header
_MAXLINE = 2048

login = 'genericmail@gmail.com'
password = 'genericpass'
pop_server = 'pop.gmail.com'
pop_port = '995'

mail_box = poplib.POP3_SSL(pop_server, pop_port)
mail_box.user(login)
mail_box.pass_(password)

The error:

raise error_proto(resp)
poplib.error_proto: b'-ERR [AUTH] Username and password not accepted.'
Andrej Hatzi
  • 312
  • 4
  • 18

1 Answers1

3

Try to enable "Access for less secure apps" in your Google Account.

Sebastian Tusk
  • 331
  • 1
  • 9
  • This setting is no longer available. – Gauthier Sep 14 '22 at 10:28
  • It is replaced by "App Password". Make sure to have two-factor-authentication enabled and go here to generate one: https://myaccount.google.com/apppasswords – harlekintiger Sep 29 '22 at 14:15
  • To help keep your account secure, from May 30, 2022, ​​Google no longer supports the use of third-party apps or devices which ask you to sign in to your Google Account using only your username and password. – Smart Manoj Oct 26 '22 at 04:11
  • @harlekintiger The setting you are looking for is not available for your account. – Smart Manoj Oct 26 '22 at 04:19