0

Once email message is received, I send some reply to the user with GAE usage:

class EmailReplyHandler(webapp2.RequestHandler): # parse email details manually
    def post(self):
        msg = email.message_from_string(self.request.body)
        from_realname, from_emailaddr = email.utils.parseaddr(msg['from'])
        ...
        email = mail.EmailMessage()
        email.to = from_emailaddr
        ...
        email.send()

...
app = webapp2.WSGIApplication([('/_ah/mail/report@myappid\.appspotmail\.com', EmailReplyHandler),

What should I indicate in the reply that user's mail software will recognize that as reply? Should I keep the same subject and add RE: as prefix? What else? Is there any solution to use different subject?

LA_
  • 19,823
  • 58
  • 172
  • 308

1 Answers1

1

Actually, it depends on the email client.

You can try by parsing Message-ID header of the inbount mail and adding it to In-Reply-To and References headers of the outbout (your reply) mail.

There are other headers you could use, see Sending Mail with Headers section.

alex
  • 2,450
  • 16
  • 22
  • Thank you. Should I remove brackets (`<` and `>`) from the `Message-ID` when using that value in `In-Reply-To`? I tried to pass it as is, but looks like GMail doesn't recognize it. – LA_ Apr 20 '14 at 13:51
  • I think it should be as is. Just did a quick search on matching gmail thread: http://www.sensefulsolutions.com/2010/08/how-does-email-threading-work-in-gmail.html – alex Apr 20 '14 at 13:56
  • Thanks. Found the same description about the subject on google pages - https://support.google.com/mail/answer/5900?hl=en – LA_ Apr 20 '14 at 14:03