问题
When users receive a notification email about a new private message on Facebook, they can reply to the email and have their response automatically added to the conversation on the site.
How can I build a cross platform system like that? I'm building a group chat system.
回答1:
This is obviously way over-simplified, but here we go:
The way Facebook's emails work is by using a string that's unique to the receiver in the reply-to
address:
<m+50edqb50000003jtdj389k6xib6hofj6t41q1c45sdt92qc@reply.facebook.com>
So when Facebook receive an email into reply.facebook.com
, they (presumably) parse the string after the plus sign, decide which user/conversation it's relevant to, and add the text of the email into that conversation.
回答2:
One option:
Send every notification email with a unique reply-to address, then receive replies with a customized SMTP server that will pair responses with the originating message object in your DB.
Since you are using django (according to your tags) I would recommend looking at the Lamson python SMTP server. It can be programmed to correctly attribute each message. Using Lamson with Django is documented.
来源:https://stackoverflow.com/questions/5405263/how-do-i-build-a-notification-email-reply-system-like-facebook