我使用send_mail
将电子邮件发送到电子邮件地址列表,但似乎没有发送到地址。
我的密钥代码如下:
from django.core.mail import send_mail
result = send_mail(subject, message, from_email, to_email_list, fail_silently=False)
print(result) # there prints `1`
我在settings.py中的电子邮件设置如下:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.qq.com' # QQ:smtp.qq.com 163:smtp.163.com
EMAIL_PORT = 465
EMAIL_HOST_USER = 'qiyunserveremail@qq.com'
EMAIL_HOST_PASSWORD = 'qiyunserver_password'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
并且回溯如下:
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: =?utf-8?b?5Li76aKY?=
From: qiyunserveremail@qq.com
To: lxt123@126.com
Date: Thu, 30 Nov 2017 03:02:26 -0000
Message-ID: <20171130030226.15096.58930@aircraftdemacbook-pro.local>
内容
-------------------------------------------------------------------------------
1 # this is the print(result)
修改
我登录了我的EMAIL_HOST_USER电子邮件,在发送的电子邮件部分,没有电子邮件。
修改-2
我尝试将EMAIL_USE_TLS=True
更改为EMAIL_USE_SSL=True
,但仍然无效。