Python Django. 发送邮件
view.py
from django.core.mail import send_mail
from django.http import HttpResponse
def index(request):
send_mail(‘Subject here’, ‘Here is the message.’, ‘136323000@qq.com’,
[‘1137082455@qq.com’], fail_silently=False)
return HttpResponse(‘1’)
Setting.py
EMAIL_BACKEND = ‘django.core.mail.backends.smtp.EmailBackend’
EMAIL_USE_TLS = False
EMAIL_HOST = ‘smtp.qq.com’
EMAIL_PORT = 25
EMAIL_HOST_USER = ‘136323000@qq.com’
EMAIL_HOST_PASSWORD = ‘xxxxxxx’
DEFAULT_FROM_EMAIL = ‘136323000@qq.com’