标签:成功 send post请求 获取 email smt rar settings com
django发邮件
1 EMAIL_BACKEND = ‘django.core.mail.backends.smtp.EmailBackend‘ 2 3 4 EMAIL_HOST = ‘smtp.qq.com‘ 5 EMAIL_PORT = 25 6 EMAIL_HOST_USER = your email address 7 EMAIL_HOST_PASSWORD = ‘our email key 8 EMAIL_FROM = ‘<your email address>‘
1 def sendEmail(request): 2 email = request.POST.get(‘email‘) # 获取post请求里面的email地址 3 subject = "" # 邮件的标题 4 message = "" # 邮件的正文 5 sender = settings.EMAIL_FROM # 邮件的发送者 6 receiver = [email] # 邮件的接受者(列表形式) 7 send_mail(subject, message, sender, receiver) 8 return HttpResponse(‘发送成功!‘)
标签:成功 send post请求 获取 email smt rar settings com
原文地址:https://www.cnblogs.com/ivy-blogs/p/10961494.html