I have a feedback form, where users can leave comments. These comments will be emailed to me and users’ email address will appears as reply_to in the header, which means I can address these comments if I click the “reply” button in the GMAIL. However, it seems like the ‘reply-to’ header does not work. Every time I click ‘reply’, I am writing to myself. Any suggestions?
The basic function is defined as below:
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)
Email header
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
The problem is I click ‘reply’, my GMAIL replies to ‘myapp@gmail.com’, not ‘abc@gmail.com’
The following is a summary of the comments.
The problem seems to be related to Gmail, as the Reply-To header is actually sent, and is because the sender and receiver are the same.
A workaround is to have a different sender and receiver address, to achieve that the email address
<app-id>@<app-id>.appspotmail.comcan be used.