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

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 their 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.

Related

MSGraph - Getting external email conversation from reply

My team is building a ticketing system. The goal is when we receive a new email we create a new ticket. All responses to that email are saved on the same ticket.
We have these basic goals working in simple cases, however, there is one case that we are struggling to find a good solution for. A client will email us, which creates a ticket, and we reply back requiring information. The client will send our reply to someone internal to their company. Then they will send the response back to us by replying with "see below". This response will have the conversation between them and their co-worker in the comment section of the email. The comment section will also contain our entire email chain which we don't want to duplicate.
The issue we are having is grabbing the conversation they had from the comment section to include with their response of "see below" and add them to the ticket. The only method we have come up with to solve this is manually parsing the comment section of the email, however, this is error-prone.
Does anyone know of a better way of tracking conversations they send you through the email?
We are using msgraph internally to send and receive emails and using their apis they have uniqueBody and body, but they don't seem to have a way to break the body up into its different parts.
What I need any of these options
1- get list of unique bodies from the email chain without using conversation Id as it will not be sufficient in some cases.
2- get the previous conversation Id of the incoming email. I mean if that email is a list of emails and it forwards to me.
UUID uuid = UUID.randomUUID();
message.addProperty("InternetMessageId", String.format("%s",uuid.toString()));
send InternetMessageId with a unique identifier to grab conversation id
change order only

Mandrill is ghosting accounts or am i incorrect - it says delivered however mandrill did not even tried to send emails

I am using free mandrill account and sending email via using template and API
When i send message it returns okay it is sent as status
However even after several days there is still no smtp events at mandrill interface and the email is not arrived
So i am 100% suree mandrill is ghosting accounts
Or there is something else that i do not know?
Thank you for answers
PS: At the beginning emails were arriving but after some point no smtp events and no emails ever arrived even though no error message parsed. Also when i send to non existing email no bounce message returned.
Also account reputation is 61 : excellent
Yes i believe mandrill certainly ghosting accounts
After trying with several accounts i am now sure of it
Even if you send to non existing gmail email, it says delivered in its interface
However it should have displayed hard bounced
So beware of their free service. I believe this is not an ethical way of working. People would think that their emails are arriving however they are ghosted and mandrill did not even try to send them and yet displays delivered
Have you check it on Mandrill account? It shows all the report at outbound tag. The reason is, a queued response in the Mandrill API is not the same as a queued response from a recipient server.
When you send a message through Mandrill, you first relay it to Mandrill, Mandrill processes it, and then Mandrill relays it to the recipient server. This all happens quite quickly, but the two relaying steps are separate and distinct. The KB article you've linked to is providing additional details on that last step, relaying to recipient servers, not a queued status for the Mandrill API.
There are a number of reasons the Mandrill API may respond with queued including if you've added attachments or if you're sending to a bunch of recipients in a single API call.
Without seeing the actual API call that's being made, it's hard to say why you're getting a queued response. But if you're using the sample messages/send API call, you'll want to remove all of the optional parameters that you're not actually setting. For example, the sample has fake attachments, and a subaccount specified. The attachment will cause the call to be processed async. The subaccount probably doesn't exist, and would then cause the call to fail. So if that's the case, try removing all of those optional params. If not, please provide the API call you're making with sensitive data redacted (API key, actual email addresses).

How do I get email analytics in sendgrid?

I am sending email using sendgrid.
Are there any options in sendgrid to get email analytics (open/bounced/replied emails) for each users email address?
I've done this two ways before:
1) Use SendGrid's Event API to collect and aggregate the data yourself.
2) Use a service like sendwithus on top of your SendGrid account, which will collect your SendGrid analytics for you and provide analytics by recipient, template, segment, etc. They also provide an API and Ruby client.
Once you're logged into SendGrid, navigate to the Stats Dashboard.
You should then be able to see something like this:
I hope this helps.
Yes, There are option available for this, to get the status of individual emails sent via sendgrid.
Send a unique arguments with every email you sent and then later on you can get status of these emails with reference to unique argument.
Some more explanation of your question will help us a-lot to describe you the best possible solution.
i have recently done this work, so if you explain the whole scenario, i will come up with the solution.
There are two ways to get hold of this data:
Use the SendGrid Event Webhook to get near realtime information about every event for every email you send via SendGrid. It works by issuing a POST request to a URL that you specify.
You can then store all this data for consumption later on and it's by far the most granular information you can get. Key/Value stores like Redis are a good option for this, but if you want a simple option to get going, check out the SendGrid EventKit to get up and running quickly.
Or:
Grab the data via the Stats API. This endpoint allows you to grab the numbers you need in a multitude of ways for both main and subuser accounts.
Based on your question, you should investigate the Event Webhook as it will give you most clarity on what happens with each email you send.
You can now use Thinbox to get analytics from Sendgrid, Mailgun, Mandrill, or just by bcc'ing an email address they give you. It's basically like EventKit but for the rest of the ESPs too.

Rails and email openened notifications

I am developing an application on Rails and I need to know if its possible to write code which will notify me when the user opens an email that has been sent from my application (need to track this info) ?
The main bit of data I need is was it opened.
thanks
You can do this but there is no 100% certainty you will always get a notification.
SMTP has 2 standards, they are DSN and MDN. Both are in effect optional, there is no guarantee that the email system of the targeted email recipient (your user) will implement them too.
The easiest way is to pit in a "Return-Receipt-To:" (RRT) email header. Put some address as the content of the header. Now when a user opens an email message containing this header, the clients email reader will msot likely prompt your users whether or not to send a return receipt. If the do comply and email will be sent to the address you specified.
In Rails it could be something like:
themailer < ActionMailer::Base
def notify_read
headers['Return-Receipt-To:'] = 'notifyread#mysite.com'
mail(:to => 'users#somecompany.com')
end
end
You could just use an email address you monitor and read them manually OR you could set up rails to read these emails as well. But there is no guarantee you will ALWAYS get an acknowledgment.
Additionally you could check each email domain, many of the big free email providers have proprietary methods of requesting the return receipt. If you add ".readnotify.com" onto the end of your recipients email address you will get a return receipt. You will have to research all the big ones though.
For example:
user#yahoo.com.readnotify.com
Hope that helps
Source: http://railsforum.com/viewtopic.php?pid=147997#p147997
A common way of implenting this is to include a link to an invisible image file, with the link including sufficient details about the email for you to be able to identify which email is being viewed.
When the image is requested by the mail client, your server can then record the viewing attempt. If you use a 3rd party email provider (such as sendgrid, postageapp) then sometimes they'll do that for you and ping your server with the appropriate event. I strongly suspect that this is what readnotify is doing under the hood (someone took the trouble of looking at this a while ago
This isn't completely accurate as some (many?) users turn off remote image viewing in their mail viewers.

iOS app creates email...is there a way to not have a copy of it in the sent folder

My app creates an email that can have sensitive data in it (depending on the users perspective). Is there a way on the iphone's email client not save a copy in the Sent folder.
And in the same way, if the user choses they can send it via text..is there a way to not have it be in the Message streams.
I'm thinking there is not but I'd love confirmation of this if possible. I've been scouring but can't seem to tell if it's possible.
Thanks.
I'll break this into two parts:
Not putting a copy of a sent message in the sent folder:
There's no easy way to do this since you don't have access to a user's mail. You could have the user enter their email service's IMAP details and write your own mail sending implementation that then goes and deletes the sent message from the server, but it's possible that mail clients would keep a local copy regardless of what happens on the server if they grab the message before you delete it. Regardless, this is a really terrible user experience (having the user enter IMAP details, not using the built in mail composer) and it'd be difficult to write (and you would need to be insanely careful about deleting something from a user's mailbox, and you'd have to ask them if it's okay to do so).
Not showing a text message in a Messages app conversation stream:
There's actually a way to do this. Text messages can be sent to users via a specially formatted email address that's different for every cell service provider. For example, to send a text to a Verizon subscriber it'd be 5551239876#vtext.com. For this solution to work you'd need to send the message using some sort of automatically generated email address that you retrieve from a mail server you've created, and then you'd need to implement your own SMTP mailer on the device. Of course, a user can always request text message transcripts from their cell service provider (and some have easy access online) and there's no way around that.
How sensitive is this information? Email and text message aren't very secure protocols. You may want to consider alternative methods that provide encryption and authentication mechanisms.
No its not possible if you are using the built in mailer in iOS. Something you could do if you wanted to get around this would be to make a customer mailer, send the information to a server and send off the mail through code but this is quite a bit more work.

Resources