Python Django 电子邮件

问题描述

您好,我有一个发送电子邮件的 Django 应用程序。我为我的 EMAIL_HOST_PASSWORD 使用了谷歌应用密码,它工作得很好,但 from_email 总是设置为我用来创建应用密码的电子邮件,而不是它从表单中获取的电子邮件。 请问我该如何解决

更新

from django.shortcuts import render
from django.core.mail import send_mail


def index(request):
    if request.method == "POST":
        name = request.POST["name"]
        email = request.POST["email"]
        phone = request.POST["phone"]
        message = request.POST["message"]

        msg = "Email: " + email + "\n" + message + "\nPhone Number: " + phone

        send_mail(
            name + " Sent Us A Message",msg,email,["myemail@gmail.com"],)

        return render(request,"index.html",{"name": name})
    else:
        return render(request,{})

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)