ユーザーがコメントを残すことができるフィードバックフォームがあります。これらのコメントは私にメールで送信され、ユーザーのメールアドレスはヘッダーにreply_toとして表示されます。つまり、GMAILの[返信]ボタンをクリックすると、これらのコメントに対応できます。ただし、「reply-to」ヘッダーが機能していないようです。「返信」をクリックするたびに、私は自分自身に手紙を書いています。助言がありますか?
基本的な機能は次のように定義されています。
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が「abc@gmail.com」ではなく「myapp@gmail.com」に返信することです。