Друзья никак не получается получить почту, выдает следующую ошибку
Traceback (most recent call last):
File "C:\Users\user\PycharmProjects\pythonProject1\inet\mail\popchik.py", line 8, in <module>
server = poplib.POP3(pop3_server)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\poplib.py", line 104, in __init__
self.sock = self._create_socket(timeout)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\poplib.py", line 112, in _create_socket
return socket.create_connection((self.host, self.port), timeout)
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\socket.py", line 843, in create_connection
raise err
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\socket.py", line 831, in create_connection
sock.connect(sa)
TimeoutError: [WinError 10060]
Попытка установить соединение была безуспешной, т.к. от другого компьютера за требуемое время не получен нужный отклик, или было разорвано уже установленное соединение из-за неверного отклика уже подключенного компьютера
Я уверен что вся инфа введена правильно, помоему проблема в настройке google, но я уже прочитал как ее настроить, но там говорят что-то про почтовых клиентов там предлагают настроить POP pop.gmail.com, но к сожалению в microsoft.outlook не получается изменить POP на pop.gmail.com, а вот если что сам код
# import python poplib module
import poplib
# input email address, password and pop3 server domain or ip address
email = input('Email: ')
password = input('Password: ')
pop3_server = input('POP3 server: ')
# connect to pop3 server:
server = poplib.POP3(pop3_server)
# open debug switch to print debug information between client and pop3 server.
server.set_debuglevel(1)
# get pop3 server welcome message.
pop3_server_welcome_msg = server.getwelcome().decode('utf-8')
# print out the pop3 server welcome message.
print(server.getwelcome().decode('utf-8'))
# user account authentication
server.user(email)
server.pass_(password)
# stat() function return email count and occupied disk size
print('Messages: %s. Size: %s' % server.stat())
# list() function return all email list
resp, mails, octets = server.list()
print(mails)
# retrieve the newest email index number
index = len(mails)
# server.retr function can get the contents of the email with index variable value index number.
resp, lines, octets = server.retr(index)
# lines stores each line of the original text of the message
# so that you can get the original text of the entire message use the join function and lines variable.
msg_content = b'\r\n'.join(lines).decode('utf-8')
# now parse out the email object.
msg = Parser().parsestr(msg_content)
# get email from, to, subject attribute value.
email_from = msg.get('From')
email_to = msg.get('To')
email_subject = msg.get('Subject')
print('From ' + email_from)
print('To ' + email_to)
print('Subject ' + email_subject)
# delete the email from pop3 server directly by email index.
# server.dele(index)
# close pop3 server connection.
server.quit()