Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am looking for an open-source / free SMTP server that will enable me to automatically change the content of outbound messages via a simple search & replace (or regular expression). It should be able to be configured to do this only for emails being sent to addresses that match certain domains.

Specifically, I have an application that sends emails containing URLs. I need to be able to be able to perform a search & replace on those URLs before the email is delivered. I cannot change the application itself, but can point it at an SMTP server of my choice.

share|improve this question

3 Answers 3

up vote 1 down vote accepted

A simple solution would be to have your email server deliver the email to a shell script via Procmail. Procmail can run the mail through an arbitrary script (by using a .forward file); the script could then remail the result in whatever form you choose.

A bit hackish (but then any solution would be), but should be easy to implement & test. I've done something similar for automatically processing Return Receipts.

This might actually be cleaner than using an SMTP server, because you are really generating a new mail, rather than messing with an existing mail (which is not really supported by established email handling standars).

share|improve this answer
    
I've decided against attempting to do this now, but I think the procmail route would be the one I'd use if I did. Thanks. –  msanders Jan 6 '10 at 10:12

Spamassassin could probably be modified fairly easily to do this.

Failing that Anomy Sanitizer might be able to do it.

share|improve this answer

if you use windows platform, I suggest you try hmail server. It is free, opensource and has a COM API which allow you to modify the content of emails.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.