D
D
Daniil Dedinets2022-03-21 17:32:05
Python
Daniil Dedinets, 2022-03-21 17:32:05

Socket.gaierror: [Errno 11003] getaddrinfo failed, what to do?

Wrote a simple code

import smtplib
from email.mime.text import MIMEText

server = smtplib.SMTP('[email protected]', 587)
# server.set_debuglevel(True)
try:
    dhellmann_result = server.verify('dhellmann')
    notthere_result = server.verify('notthere')
finally:
    server.quit()

print('dhellmann :', dhellmann_result)
print('notthere :', notthere_result)

Issues
Traceback (most recent call last):
  File "C:\Users\1289727\OneDrive\Рабочий стол\test.py", line 5, in <module>
    server = smtplib.SMTP('[email protected]', 587)
  File "C:\Users\1289727\AppData\Local\Programs\Python\Python37\lib\smtplib.py", line 251, in __init__
    (code, msg) = self.connect(host, port)
  File "C:\Users\1289727\AppData\Local\Programs\Python\Python37\lib\smtplib.py", line 336, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "C:\Users\1289727\AppData\Local\Programs\Python\Python37\lib\smtplib.py", line 307, in _get_socket
    self.source_address)
  File "C:\Users\1289727\AppData\Local\Programs\Python\Python37\lib\socket.py", line 707, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "C:\Users\1289727\AppData\Local\Programs\Python\Python37\lib\socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11003] getaddrinfo failed

Moreover, if corrected for at least
import smtplib

server = smtplib.SMTP('[email protected]', 587)

That will be the same error. I already realized that the problem is most likely due to the connection. VPN and 4g with wi-fi tried to change and combine, it didn’t help, what should I do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2022-03-21
@donko1

Something tells me that instead of email, you need to specify the address of the SMTP server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question