What features do you want to see added to Mailgun?

Extract the original sender of a forwarded email

How can I get the address of the original sender, when an email has been forwarded to Mailgun?

The chain of events looks like this:

originalSender sends message to someUser
someUser forwards message to Mailgun
Mailgun POSTs a parsed message to my server
Put in another way:

orignalSender (send)-> someUser (forward)-> mailgun (POST)-> myserver

The best I could get is doing a regex on the "body-plain" property.
The problem is that email clients do send this differently. Here are two examples.

Forwarding from GMail (I added the ...):

body-plain: "---------- Forwarded message ----------\r\nFrom: Kalle Kalleson <kalle.kalleson@mail.com>\r\nDate: 2014-02-13\r\n ..."
Forwarding from Apple's Mail (I added the ...):

body-plain: "(...)Begin forwarded message:\r\n\r\n> From: Kalle Kalleson <kalle.kalleson@mail.com>\r\n> Subject: New color printer\r\n> Date: 11 February, 2014 15:47:19 GMT+1\r\n>

There must be a better way of doing this, right?

http://stackoverflow.com/questions/21774983/getting-the-original-sender-when-forwarding-emails

25 votes
Sign in
(thinking…)
Sign in with: Facebook Google
Signed in as (Sign out)

We’ll send you updates on this idea

Alex Schenkman shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

2 comments

Sign in
(thinking…)
Sign in with: Facebook Google
Signed in as (Sign out)
Submitting...

Feedback and Knowledge Base