标签:obj ica 三方 format 第三方 点击 features body image
Python2.7 + Django1.10.0
# Host for sending email. EMAIL_HOST = ‘smtp.qq.com‘ # Port for sending email. EMAIL_PORT = 587 # Optional SMTP authentication information for EMAIL_HOST. EMAIL_HOST_USER = ‘gjp_1988@qq.com‘ EMAIL_HOST_PASSWORD = ‘获取的授权码‘ EMAIL_USE_TLS = True #必须为True EMAIL_USE_SSL = False EMAIL_SSL_CERTFILE = None EMAIL_SSL_KEYFILE = None EMAIL_TIMEOUT = None # Default email address to use for various automated correspondence from # the site managers. DEFAULT_FROM_EMAIL = ‘gjp_1988@qq.com‘
进入shell界面
hester@hester-virtual-machine:~/django_project/sample1/mysite$ ./manage.py shell
fPython 2.7.12 (default, Nov 12 2018, 14:36:49)
Type "copyright", "credits" or "license" for more information.
IPython 2.4.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython‘s features.
%quickref -> Quick reference.
help -> Python‘s own help system.
object? -> Details about ‘object‘, use ‘object??‘ for extra details.
In [1]: from django.core.mail import send_mail In [2]: email_title = ‘from hester‘ In [3]: email_body = ‘password reset‘ In [4]: email = ‘gjp_1988@163.com‘ In [5]: send_mail(email_title,email_body,‘gjp_1988@qq.com‘,[email])
如果返回值为1表示发送成功,登录163邮箱查看收件箱
标签:obj ica 三方 format 第三方 点击 features body image
原文地址:https://www.cnblogs.com/hester/p/10540553.html