18.9 Adding a Tag to Each Outgoing Message

Some organizations want to add a footer to every message with text that identifies the company, includes disclaimers, or makes implausible claims about the legal status of messages. This is another problem that's easily solved with qmail-qfilter, in this case so easily that it doesn't even need a program of its own, just a two-line script I'll call addtag, as shown in Example 18-4.

Example 18-4. addtag script to add a tag to messages
#!/bin/sh exec /var/qmail/bin/qmail-qfilter \     cat - /etc/mailtag

Put the tag in /etc/mailtag, and set QMAILQUEUE to run the tagging script in ofmipd and anywhere else that mail is injected. If local programs inject mail with sendmail, you might want to rename /var/qmail/bin/sendmail to realsendmail and put this in its place:

#!/bin/sh QMAILQUEUE=/var/qmail/bin/addtag exec /var/qmail/bin/realsendmail "$@"

If you use the older fixup approach to inject mail, you can add the tag in .qmail-fixup-default, as shown in Example 18-5.

Example 18-5. .qmail-fixup that adds a tag
| bouncesaying 'Permission denied' [ "@$HOST" != "@fixme" ] | cat - /etc/mailtag | qmail-inject -f "$SENDER" -- "$DEFAULT"


qmail
qmail
ISBN: 1565926285
EAN: 2147483647
Year: 2006
Pages: 152

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net