I need get each email status whether it is delivered, bounces, etc.,
Only i'm able to getting the total count of each status. But i need to get by each email id or message id(After sent).
This is accomplished using SendGrid's EmailActivity API. You have to purchase "Additional Email Activity History" on your account in order to access this API. I think it's an extra $5/month at time of this answer.
You need SendGrid's Event Webhook implementation. They do not have a per-message "pull" method, but the Event Webhook is a near-live "push" method, which will send you all the data/events from all your messages as they happen.
Related
I am using GraphAPI for sending email. I have a situation where I need to Save a copy of the email sent. I can retrieve the Messages using graph api. How do I identify the email I just sent? When I use the SendEmail endpoint of the Graph api, I get a 200 OK response. How do I identify the email I just sent so I can download that email?
I have tried a number of solutions, adding custom Identifiers and filtering it but none of them worked.
I haven't tried this, but this approach seems it would work: https://learn.microsoft.com/en-us/graph/outlook-immutable-id#immutable-id-with-sending-mail.
Create the message as a draft with Prefer: IdType="ImmutableId" header
Save the returned id
Send the draft
Note that email sending is asynchronous so you might not be able to download the sent email right away. It could take some time to be available.
I have a C# Mailkit program that automatically sends emails to an email list. I have a web server with a database filled with email addresses and I want to incorporate an unsubscribe link within my emails. Is there any way of tracking the email address of the person who clicked the link? I essentially just want to remove the email from the database of the person who unsubscribed.
Are there any kind of special links/anything I can do to pull the user's email address after they click the link?
thank you.
"When creating email message with mailkit inside the body create unsubscribe link which contains email in query parameter.Like in my example above. That link needs to point to your web server on specific endpoint which can read email address from that query string and remove it from datsbase. – SlobodanT"
"Don't use encryption for this. Don't pass user information like emails in links. When you send a user an email, store a GUID for that user or email and include it in the unsubscribe link; something like http://example.com/unsubscribe/GUID HERE. Your unsubscribe page looks up the email or user and unsubscribes them. – Dour High Arch "
I have difficulties implementing the following scenario.
Let's say you have a web site with ability to send and recieve messages between users.
User recieves an email with notification he has a new message on the software system (doesn't matter in what it is implemented). He can respond to this message by sending a reply via email or by logging into the site and replying to the 'message' using the site.
In case of the first approach if user simply replies to the email notification, how can you (as a developer) know what 'message' (ID) is the reply for?
I'm thinking the info would be stored in the MIME extensions. Are the MIME extensions transfered to the reply of the message? If yes than the solution could be to see the data of the original message notification for wich the user replyes to.
Any ideas? Thank you
The only “reliable” way would be to encode that information in the sender's address to which the user replies; you could also put it into subject or body of the message, and “hope” that the user doesn't tamper with it. There is an “in reply to (message-id)” header, but a lot of existing eMail clients don't set the header properly.
The usual mechanism is something like this: create an eMail alias prefix, and the append a message-id-code fragment to the end; for example, if this was for a purchase order confirmation, you could create an eMail alias handling addresses of the form po-*#example.com, where * is the unique message ID. Then, when you send your message out, you'd put the appropriate address in both the From: and Reply To: headers. EG:
From: "Purchase Order Confirmation (#1234)" <po-1234#example.com>
To: "John Doe" <jdoe#example.com>
Reply-To: "Purchase Order Confirmation (#1234)" <po-1234#example.com>
Subject: Confirm your order (#1234)
Depending upon your mail server, you should be able to define a “separator” character (typically - or +) that is used to split up the parts of the “local part” (left of #) of the eMail address; there is typically then another mechanism to map a prefix to a script to handle all addresses of a certain form. The script interface is often very much like CGI on the web, sending in some environment variables and piping the message itself in on the standard input. If your app is primarily web-based, you might find it more “comfortable” to gather the incoming eMail body, and POST it to a private (perhaps http://[::1]/getMailReply) handler. This may help you reuse existing code more readily.
We have set up a catch-all email address on our server - for example catch-all#myserver.com. When we send emails to users, we encode the message id and any other meta information we may need in the from address. You can obfuscate this or not, depending on what your needs are. So, for example, if the user has a new message in the system whose ID is 100, the from address of the email we send to the user would be something like reply-to-message-100#myserver.com. Make sure that whatever format you use for the from address would never generate a real email address on your mail server.
So, when the user responds to this message, it will get sent to the catch-all inbox you have set up. From here, you have a number of choices to make on how you process this email. In times past, we wrote a little scheduled service that would run every few minutes and check this inbox for new emails, process them as you like (insert into db, send more emails, whatever), and delete the message since you're done processing it. This is fragile since email clients all have slightly different ways of sending emails and it becomes difficult to parse the variety of client messages out there.
The second way we've done it is by integrating with http://postmarkapp.com/ - which has an incoming email api that should go public soon (we got in on the beta). You'd set everything up the same way only make your server's catch-all address forward to the postmark incoming address you'll set up with Postmark, and then Postmark does the message processing and calls a webhook you also set up to do what you like with the object received.
I highly recommend Postmark, but even the homespun method worked effectively, for the most part.
-M
Just a followup to the previous answer, Postmark Inbound is now live and public http://postmarkapp.com/inbound For each email sent to your specially formatted inbound email address, you'll receive a JSON formatted web hook API call with all the email components, headers, attachments sorted for you.
I am trying to find a solution that can handle messaging via email.
When a user creates a message in my application, an email is sent using subject #4857474.
Then, the email recipient can reply, without changing the subject, and my application would know what message it used, based on the #id in the subject.
Now, I do not want to implement such service because its rather complex. What I am looking for is a service that provides this, and just calls my web services for a request when a new message has arrived.
Is there such thing? Thanks!
In the smtp standard there are two header fields that can be used for this: message-id and in-reply-to.
Assign a unique message id when you send the mail, then inspect the in-reply-to field in messages you receive. Since the field is hidden from user input, there is no risk that the user messes with it.
I don't think there is a default component you could use. Also it wouldn't be a very complex flow i think.
Just read out the subject and trigger your app?
Is email a must or can you also use a webbased reply form? Then you could use just a database.
Edit:
Read email from C# http://www.codeproject.com/KB/IP/despop3client.aspx
Create a thread that runs for ever and reads out the mailbox. If a email matches your criteria (subject) then trigger your webservice.
I am looking at the c# .Net libraries from sendgrid to send emails from my applications. I can only see a DeliverAsync method within Web and I don't see any Deliver method as shown in some examples..
1) if I want to know the result of that email(success/Failed/smtp status codes), How and where do I get that information? Is there any result object?
2) if I want to track the status of the email later like whether it sent to spam or user opened it How can I do that. DO they have any tracking number/id for the email which I can get from the result object and use it later to get status through their API?
I am new to using Sendgrid libraries. So any help is appreciated.
Thanks
There's no result object in the sending of the message, since that can take some time.
The best way is to leverage the Event Webhook, so that you can receive POSTs with JSON data about your messages. you can even leverage unique_args to positively relate events to a particular message.
Depending on what you want to do, you might want to try a templating API, like sendwithus. They'll integrate with SendGrid events for you and give a UI showing events and status of every email.