Python 發送郵件 socket.gaierror: [Errno 11004] getaddrinfo failed

 

 

======================================

Traceback (most recent call last):
  File "D:/soft/test.py", line 140, in <module>
    main_runnow()
  File "D:/soft/test.py", line 133, in main_runnow
    sendmail(str(disk_free),files)
  File "D:/soft/test.py", line 42, in sendmail
    smtp = smtplib.SMTP_SSL("smtp.163.com",994) #實例化smtp服務器
  File "C:\Python38\lib\smtplib.py", line 1043, in __init__
    SMTP.__init__(self, host, port, local_hostname, timeout,
  File "C:\Python38\lib\smtplib.py", line 255, in __init__
    (code, msg) = self.connect(host, port)
  File "C:\Python38\lib\smtplib.py", line 339, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "C:\Python38\lib\smtplib.py", line 1049, in _get_socket
    new_socket = socket.create_connection((host, port), timeout,
  File "C:\Python38\lib\socket.py", line 787, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "C:\Python38\lib\socket.py", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11004] getaddrinfo failed

======================================

可能做了設置,不能訪問某些網站IP等。

比如不能訪問 smtp.163.com

======================================

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章