开发者

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

开发者 https://www.devze.com 2023-02-19 00:21 出处:网络
When users receive a notification email about a new private message on Facebook, 开发者_如何学Gothey can reply to the email and have their response automatically added to the conversation on the site.

When users receive a notification email about a new private message on Facebook, 开发者_如何学Gothey 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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消