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

We have a nice corporate email signature (NOT a huge disclaimer document, just a consistent 4-line email signature) that we have configured our email clients to use. It is small, tasteful, and degrades very well for plain text emails, too.

There are three problems with our setup.

  1. It is possible to accidentally modify the signature and no one here actually wants to do that, ever. We like consistency. :)
  2. Every machine has to be reconfigured if any changes are needed, such as adding a new social network, for example.
  3. Mobile Email: This is the real problem. iOS Mail gives one email signature for ALL mailboxes. That means no replying from the "support" or "sales" box without revealing you are out of the office and discarding your company brand in the process. Or it means having all personal emails require editing so the company name doesn't get pushed to all friends and relatives.

I would like to use a wrapper script to pattern match on the email body, looking for an email token such as {{{auto-signature-from-fullname}}} and replace it with the actual signature content. Server-side, the script would consider the email "From" (support? sales? webmaster?) and MIME section (html? plain?) to determine which email signature to inject. Client-side, the email application would still be determining where the signature belongs, so AFAIK we won't risk corrupting email attachments with this approach. Additionally, email clients with single-signature support (iPhone, iPad) will get the benefit of a proper signature since the signature token is consistent per-employee.

We are using qmail v1.06 with patches, although we are not opposed to using a different Linux MTA or an extra SMTP relay, if necessary. A wrapper script, piping stdin/stdout, is really what we need over source patching.

Note: I have seen questions similar to this on Server Fault that are only getting "don't do it" replies. I am posting my question because my need/idea is a bit different than just a blind automatic email footer. Any help offered is very much appreciated. Thanks!

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Well "don't do it" is the correct answer. Using the MTA to change email contents creates so many problems that it is not worth it.

But if you really want to put yourself through the pain, I would suppose that using the qmailqueue patch will work. This allows qmail-smtpd to call a program other than qmail-inject when it receives a message. It is usually used to scan the email with some antivirus/antispam software but nothing says it can't do anything else you might want.

Create a script that could be inserted via QMAILQUEUE that would decompose the MIME structure of emails and do the appropriate replace and then recreate the message. Perl and Mail::MIME will probably be your friend.

Good luck ;-)

share|improve this answer
    
Thanks for the help! I plan to try this soon as an experiment when I get some free time, so I'll report back later. –  jimp Feb 9 '12 at 17:25

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.