Gaierror from python smtplib
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.
精彩评论