开发者

Gaierror from python smtplib

开发者 https://www.devze.com 2023-03-19 04:03 出处:网络
This line is throwing a gaierror... any idea why? Could it be a firewall开发者_JAVA技巧? smtp=smtplib.SMTP(host=EMAIL_HOST,port=EMAIL_PORT)

This line is throwing a gaierror... any idea why? Could it be a firewall开发者_JAVA技巧?

smtp=smtplib.SMTP(host=EMAIL_HOST,port=EMAIL_PORT)

I'm using gmail so the host is 'alt1.gmail-smtp-in.l.google.com', and the port is 587.


Even if this weren't a gaierror (which, as AJ rightly says is a DNS lookup error), that host doesn't work for me either.

Specifically, it hangs trying to connect and times out.

However, the following seems to work:

import smtplib
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
smtp=smtplib.SMTP(host=EMAIL_HOST,port=EMAIL_PORT)

Hope that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消