我的index.html中包含以下代码行
<form action="" method="POST" id="contact-form">{% csrf_token %}
<div class="form-group">
<input type="text" id="form_name" class="form-control" name="name" required="required"
placeholder="Your Full Name"
value='{% if submitbutton == "Submit" %} {{ name }} {% endif %}'>
</div>
<div class="form-group">
<input type="email" id="form_email" class="form-control" name="email" required="required"
placeholder="abc@email.com"
value='{% if submitbutton == "Submit" %} {{ email }} {% endif %}'>
</div>
<div class="form-group">
<textarea name="message" id="form_message" rows="5" class="form-control" required="required"
placeholder="Add your message."
value='{% if submitbutton == "Submit" %} {{ message }} {% endif %}'></textarea>
</div>
<input type="submit" class="btn btn-outline-light btn-sm" value="Send Message" name="Submit">
</form>
和views.py
def index(request):
if request.method == 'POST':
name = request.POST['name']
email = request.POST['email']
message = request.POST['message']
try:
send_mail( name, message, email, ['cmadiam@ruthlymtspmuandaesthetics.com'], fail_silently=False)
except BadHeaderError:
return HttpResponse('Invalid header found.')
return HttpResponse('Success! Thank you for your message.')
return render(request, "index.html", {})
现在,我想在收到电子邮件的名称(主题)之前添加新查询来自:。
我该怎么做。有可能吗?
提前谢谢!
答案 0 :(得分:0)
更改此行
.exe
收件人
send_mail( name, message, email, ['cmadiam@ruthlymtspmuandaesthetics.com'], fail_silently=False)