修改 Django 的邮件发送模块
/django/core/mail.py
源文件(行:65):
修改为:
为了解决我的 qmail 服务器 ESMTP 身份验证的问题。
源文件(行:65):
try:
server = smtplib.SMTP(settings.EMAIL_HOST, settings.EMAIL_PORT)
if auth_user and auth_password:
server.login(auth_user, auth_password)
server = smtplib.SMTP(settings.EMAIL_HOST, settings.EMAIL_PORT)
if auth_user and auth_password:
server.login(auth_user, auth_password)
修改为:
try:
server = smtplib.SMTP(settings.EMAIL_HOST, settings.EMAIL_PORT)
server.ehlo()
if auth_user and auth_password:
server.esmtp_features["auth"] = "LOGIN PLAIN"
server.login(auth_user, auth_password)
server = smtplib.SMTP(settings.EMAIL_HOST, settings.EMAIL_PORT)
server.ehlo()
if auth_user and auth_password:
server.esmtp_features["auth"] = "LOGIN PLAIN"
server.login(auth_user, auth_password)
为了解决我的 qmail 服务器 ESMTP 身份验证的问题。