Iis – How to rewrite the FROM header and Body of an Email sent through IIS SMTP

amazon ec2iissmtp

Don't know a ton about windows.
I have a interesting problem.

We have a 2003 server on amazon ec2 that houses a special 3rd party app. This app sends emails back to a support email address but it uses the sender's FROM address like 'user@userhost.com'.

We have a 3rd party email provider that does our email as sending email from ec2 itself is notoriously difficult. I have set up IIS smtp to use this 3rd party emailer as a smart host but I still need to figure out how to rewrite the FROM line to an address that the 3rd party wants to use. It will only use pre-authorized email addresses as a spam prevention.

For example we have authorization to send email from 'support@oursite.com' but NOT 'randomjoe@random.com'.

Is there some sort of middleware or IIS functionaltiy I can use to rewrite my FROM header on the fly before forwarding it to my 3rd party provider? I have no control over the software that actually sends it — it is closed source — I just have the control over the IIS smtp server.

I know of a way I could do this in postfix but I don't want ANOTHER server just for something so simple.

Best Answer

You're looking for an SMTP event sink to do what you're trying to do.