How do I build a notification email/reply system like Facebook?

 ̄綄美尐妖づ 提交于 2019-12-05 02:48:36

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!