Python——Django框架——邮件
#引用EMAIL服务 EMAIL_BACKEND = 'django.cpre.mail.backends.smtp.EmailBackend' #EMAIL发送服务器 EMAIL_HOST = 'smtp.qq.com' #EMAIL发送端口 EMAIL_PORT = '465' #EMAIL授权码 EMAIL_HOST_PASSWORD = 'jsdqchtegwxjbhjd' # qq邮箱此值为True,163可以忽略此值 EMAIL_USE_TLS = True #邮EMAIL发送人 EMAIL_FROM = '344846258@qq.com'
def send_my_email(request): title = '标题' msg = '消息体' email_from = settings.EMAIL_FROM reciever = [ '744537385@qq.com' ] send_mail(title,msg,email_from,reciever) return HttpResponse('发送成功')