在我的settings.py
文件中,我有以下内容:
ACCOUNT_EMAIL_VERIFICATION = "none"
EMAIL_HOST = "smtp.gmail.com"
EMAIL_HOST_USER = "thatotherbatman@gmail.com"
EMAIL_HOST_PASSWORD = "supersecretstring"
EMAIL_PORT = 587
EMAIL_USE_TLS = True
然后我运行python manage.py shell
并执行:
from django.conf import settings
from django.core.mail import send_mail
send_mail("foo", "bar", settings.EMAIL_HOST_USER, ["otheruser@gmail.com"])
产生这个:
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
我还在我的Google帐户中启用了安全性较低的应用。我做错了什么?
答案 0 :(得分:0)
在晚上尝试pip install
时遇到同样的错误。重新启动机器,错误就消失了。