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 <firstname.lastname@example.org>\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 <email@example.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?
This is a feature I could really do with too. Is it not possible to see the original sender from some mime header?
Is there any progress on this?