GAE邮件API reply_to功能

时间:2012-09-20 20:42:49

标签: google-app-engine gmail

我有一个反馈表单,用户可以在其中发表评论。这些评论将通过电子邮件发送给我,用户的电子邮件地址将在标题中显示为reply_to,这意味着如果我点击GMAIL中的“回复”按钮,我可以解决这些评论。但是,似乎'回复'标题不起作用。每次点击“回复”,我都会写信给自己。有什么建议吗?

基本功能定义如下:

HTML CODE

<!-- 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 CODE

#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'

1 个答案:

答案 0 :(得分:1)

以下是评论摘要。

问题似乎与Gmail有关,因为实际发送了回复标头,因为发件人和收件人是相同的。

解决方法是使用不同的发件人和收件人地址,以实现可以使用电子邮件地址<app-id>@<app-id>.appspotmail.com