Reputation: 9652
I would like to programmatically receive e-mails without the hassle of handling standard mail protocols (SMTP).
Is it possible to set a Mailgun route to forward (POST) all mail to an HTTP(S) endpoint? Currently, it seems to me that the provided webhooks can only notify you, rather than POST an entire email.
Upvotes: 3
Views: 4053
Reputation: 631
For someone landing here still looking for an answer, here's what I needed and what I did:
I needed any emails sent to any random (even non-existent) email address on my domain, eg, mydomain.com to be forwarded to my webhook with the contents of the email. All of these email clients (Sendgrid, Zoho, Mailjet, etc.) do provide such APIs, often called "Incoming email Parser API", but they all require you to have these "delivery" email addresses to be existent (costing your per-user cost for every new email address on your domain). So, if you've 100,000 users, you'd need 100,000 email Ids to be registered with these vendors for these emails to be forwarded to your webhook correctly.
Except, that's not the right solution. I can't pay for every email on my domain, specially when the users don't use my domain for emailing purposes. I, rather, was setting some random email for the user (say, [email protected]), and needed all the emails sent to this email to be forwarded to my webhook so that I could inform my user on his/her registered email.
To do that, you could achieve it in 02 ways:
I was here looking for an alternative free solution.
Upvotes: 0
Reputation: 21
Mailgun supports forwarding messages to an HTTP endpoint using the Forward action under routes. You can forward in Sumo Parsed format OR just post the actual mime content using a flag within the Forward URL. https://documentation.mailgun.com/en/latest/user_manual.html#routes
When you specify a URL of your application as a route destination through a forward() action, Mailgun will perform an HTTP POST request into it using one of two following formats:
Fully parsed: Mailgun will parse the message, transcode it into UTF-8 encoding, process attachments, and attempt to separate quoted parts from the actual message. This is the preferred option. Raw MIME: message is posted as-is. In this case you are responsible for parsing MIME. To receive raw MIME messages, the destination URL must end with mime.
Upvotes: 2
Reputation: 1242
The Mailgun Routes API will notify you, and also provide a URL where you can download the full email content.
If that is not sufficient, you might want to look at SendGrid or Mandrill. I believe Mandrill POSTs the entire email data in their webhook.
Upvotes: 5