我有一个反馈表,用户可以在其中发表评论。这些评论将通过电子邮件发送给我,用户的电子邮件地址将在标题中显示为 reply_to,这意味着如果我单击 GMAIL 中的“回复”按钮,我可以处理这些评论。但是,“回复”标题似乎不起作用。每次我点击“回复”时,我都是在给自己写信。有什么建议么?
基本功能定义如下:
代码
<!-- The contact form-->
<form method="POST" action=contactus_output.html>
<table align="center" cellpadding="15" cellspacing="15">
<tr><th colspan="2" align="left"><h1>Contact Form</h1></th></tr>
<tr><th>Name:</th><td><input type="text" name="nm.name" id="id.name" required="required" /></td></tr>
<tr><th>Email:</th><td><input type="email" name="nm.email" id="id.email" required="required" /></td></tr>
<tr><th>Subject:</th><td><select id="sub" name="nm.sub" required="required"/><option value="" selected="selected">Select one of the subjects</option><option value="1" >Suggestion</option><option value="Bug report" >Bug report</option><option value="Other" >Other</option></select></td></tr>
<tr><th>Message:</th></tr>
<tr><th></th><td><textarea id="msg" rows="10" cols="40" name="nm.msg" required="required"></textarea></td></tr>
<tr><td colspan="2"><input type="submit" value=" Let us know! "></td></tr>
</table>
</form>
Python代码
#define the function
def sendanemail(name,subj, rply, msg):
message = mail.EmailMessage(sender="Support <myapp@gmail.com>")
message.subject = subj
message.to = "Ubertool Support <myapp@gmail.com>"
message.reply_to= rply
message.cc = rply
message.body = '''A message submitted by %s, %s \n''' %(name, rply)
message.body = message.body+msg
message.send()
def post(self):
form = cgi.FieldStorage()
name = form.getvalue('nm.name')
rply = form.getvalue('nm.email')
subj = form.getvalue('nm.sub')
msg = form.getvalue('nm.msg')
sendanemail(name,subj, rply, msg)
电子邮件标题
from: Support myapp@gmail.com via 2uix4h7xygsz66weerlq.apphosting.bounces.google.com
reply-to: abc@gmail.com
to: Support <myapp@gmail.com>
cc: abc@gmail.com
date: Thu, Sep 20, 2012 at 5:20 PM
subject: Other
mailed-by: 2uix4h7xygsz66weerlq.apphosting.bounces.google.com
问题是我点击“回复”,我的 GMAIL 回复到“myapp@gmail.com”,而不是“abc@gmail.com”