Add ability to control which fields are sent when using Routes, and then allow the inbound message to be forwarded from Mailgun servers...
Usecase for this is: I'm using Routes to receive inbound mail to a certain domain. And I want to write some code to make decisions on whether to forward that inbound mail on to another email inbox or maybe just discard it. Currently, my only choice to implement a system like this is to have the entire email, with attachments, posted to my web hook, and then I pull out every part of the mail, plus attachments (storing them locally), and if I want to forward on the email, I have to reassemble the message, (with attachments :)) and then send it on through the MG api.
I would rather be able to specify which fields are posted to my webhook, maybe just the sender's ip, and sender's name, and subject (because maybe those are the only fields I'm using in my decision making process)... and then, If I decide to forward the email on to my inbox, I would be able to reference the stored message on the MG servers with a message id, and indicated to MG that I would like it to be sent on to a certain address.
The email is already stored for 3 days and this would be fine... I just want the ability to send an api call to MG and specify the message id of a stored message and tell MG to send it out, (without having to provide the entire message from my server).
This would save bandwidth in both directions, from MG to my hook, and from my hook back to the MG api.
Darius Bradbury commented
I'd just like to point out that without this feature - isn't it impossible to "recreate" the original message and forward appropriately, as you'd need to recreate the headers (thus appearing to be spoofing the sender), or not (meaning the from address is not the real from address, and will be blocked by spam filters).
How are people manually "forwarding" without this feature from Mailgun?
thanks Paul for the vote and comment!.. hopefully someday they might implement this.
Paul Lemke commented
I love this idea. Here is our usecase:
We need to deal with user replies and forwarding of message accordingly. We send emails out with: "email@example.com" as the sending email address. When someone sends a message to that email address we want to look up user "asdf23151asdf" and forward the message to their "firstname.lastname@example.org". It'd be awesome if we could just send a "forward('email@example.com')".
Instead we have to download the full message, including attachments, and re-send it with said attachments to the user itself. It's a big PITA.