当前位置 : 主页 > 手机开发 > harmonyos >

Python 发送邮件 socket.gaierror: [Errno 11004] getaddrinfo failed

来源:互联网 收集:自由互联 发布时间:2023-10-08
====================================== 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

 

 

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

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

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

 



上一篇:Python入门示例系列21 面向对象(初级)
下一篇:没有了
网友评论