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.
- It is possible to accidentally modify the signature and no one here actually wants to do that, ever. We like consistency. :)
- Every machine has to be reconfigured if any changes are needed, such as adding a new social network, for example.
- 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!
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 ;-)