我有一个反馈表单,用户可以在其中留下评论。这些评论将通过电子邮件发送给我,用户的电子邮件地址将在标题中显示为reply_to,这意味着我可以通过点击GMAIL中的“回复”按钮来处理这些评论。但是,“回复”头似乎不起作用。每次我点击“回复”,我都是在给自己写信。有什么建议吗?
基本函数定义如下:
HTML代码
<!-- 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‘。
发布于 2012-09-25 04:49:17
以下是评论的摘要。
这个问题似乎与Gmail有关,因为回复标头实际上是发送的,而且是因为发送者和接收者是相同的。
一种解决方法是使用不同的发送方和接收方地址,以实现可以使用电子邮件地址<app-id>@<app-id>.appspotmail.com。
https://stackoverflow.com/questions/12520627
复制相似问题