Configuring central email disclaimers

Email disclaimers are more and more used by companies for legal or marketing reasons. This article describes how to add disclaimers to all outgoing email messages. For email disclaimers the opensource project Altermime is used.

$ cd /root
$ wget http://www.pldaniels.com/altermime/altermime-0.3.10.tar.gz
$ tar zxvf altermime-0.3.10.tar.gz
$ cd altermime-0.3.10
$ make
$ make install

Some Linux distributions also include Altermime as a package in the repository. Add the user "filter" as a Linux user.

useradd -r -c "Postfix Filters" -d /var/spool/filter filter

Create the filter directory.

mkdir /var/spool/filter
chown filter.filter /var/spool/filter
chmod 750 /var/spool/filter

Comment the following line in the /etc/postfix/master.cf

#smtp      inet  n       -       n       -       -       smtpd

Add the following lines to the /etc/postfix/master.cf

192.168.0.1:smtp    inet  n       -       n       -       -       smtpd
127.0.0.1:smtp      inet  n       -       n       -       -       smtpd
      -o content_filter=disclaimer:
disclaimer   unix    -       n       n       -       -       pipe
   flags=Rq user=filter argv=/etc/postfix/disclaimer -f ${sender} -- ${recipient}

In this case disclaimers will only be added to emails send from localhost. Create the file /etc/postfix/disclaimer and add the following lines.

#!/bin/sh

# Localize these.
INSPECT_DIR=/var/spool/filter
SENDMAIL=/usr/sbin/sendmail

# Exit codes from
EX_TEMPFAIL=75
EX_UNAVAILABLE=69 

# Clean up when done or when aborting.
trap "rm -f in.$$" 0 1 2 3 15 

# Start processing.
cd $INSPECT_DIR || { echo $INSPECT_DIR does not exist; exit
$EX_TEMPFAIL; }

cat >in.$$ || { echo Cannot save mail to file; exit $EX_TEMPFAIL; } 

/usr/bin/altermime --input=in.$$ \
                   --disclaimer=/etc/postfix/disclaimer.txt \
                   --disclaimer-html=/etc/postfix/disclaimer.html \

$SENDMAIL "$@" $$>

Make this script executable:$$>

chown filter.filter /etc/postfix/disclaimer
chmod 755 /etc/postfix/disclaimer

Create a disclaimer file in /etc/postfix/disclaimer.txt and disclaimer.html. Restart Postfix to activate the changes.

$ /etc/init.d/postfix restart

Email disclaimers are more and more used by companies for legal or marketing reasons. This article describes how to add disclaimers to all outgoing email messages. For email disclaimers the opensource project Altermime is used.

$ cd /root
$ wget http://www.pldaniels.com/altermime/altermime-0.3.10.tar.gz
$ tar zxvf altermime-0.3.10.tar.gz
$ cd altermime-0.3.10
$ make
$ make install

Some Linux distributions also include Altermime as a package in the repository. Add the user "filter" as a Linux user.