开发者

How can I integrate internal messaging with emails in asp.net?

in github when a user sends you a message two things happen. You get a "new Message" on your github dashboard and you receive an email.

if you reply to that email it triggers a new Github message internally... so the users can actually have a full conversation through their email client without going into github even though Github is managing it all.

I know Malgun/Sendgrid have apis to manage receiving of emails (they send a POST request to your app when an email is received) but I need a little more info on how to do it... how exactly can I set up my app so that when a user receives a message they can just hit reply on their favorite email client while still maintaining track of that conversation. (they can still check t开发者_C百科heir messaging history through my site)

Does anyone have an idea how exactly they do it?

Please help.


How this is implemented really depends on how you can handle incoming messages. If you're able to receive your emails as a POST to your application, then the email is really no different to a user sending the message on your site, you just need to parse the From: header from the email, and look up the user, and strip the fluff out of the email.

If you're writing your own code to handle the emails (eg. that polls a mailbox), then you could just POST them over to your app in the same way, or parse them up and POST more structured data.

Once you have the data, it's easy to construct a message and write it to your DB (and fire off email notification to the user, remembering to set the Reply-To: or From: headers so your script gets the replies). Most of these kind of messaging systems don't keep track of conversations/threads, but just store a string subject (and use "Re: ...") to keep things simple, though you could obviously add this if you're feeling ambitious!

If you're doing this, you should be security in mind - malicious users may POST to your email script, and email headers can easily be forged. Spammers will also use any possible scripts they can find to relay mail through other peoples servers.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜