My Tech Scrap
Flipkart.com

Translate

Wednesday, 15 April 2009

Automatically Add Disclaimers To Outgoing Emails With alterMIME On Fedora 8

Automatically Add Disclaimers To Outgoing Emails With alterMIME On Fedora 8

Version 1.0
Author: Oliver Meyer
Last edited 02/19/2008

This document describes how to install and configure alterMIME as a Postfix filter on a Fedora 8 system. The resulting system will automatically add disclaimers to outgoing emails.

This howto is a practical guide without any warranty - it doesn't cover the theoretical backgrounds. There are many ways to set up such a system - this is the way I chose.

1 Preliminary Note

A running (and properly configured) Postfix server is required for this setup.

2 Needed Package

yum -y install altermime

3 Configuration

3.1 Altermime

First we create a system-account for altermime.

useradd -r -c "Postfix Filters" -d /var/spool/filter filter
mkdir /var/spool/filter
chown filter:filter /var/spool/filter
chmod 750 /var/spool/filter

Next we create a script that'll execute altermime.

vi /etc/postfix/disclaimer

It should look like this:

#!/bin/sh

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

####### Changed From Original Script #######
DISCLAIMER_ADDRESSES=/etc/postfix/disclaimer_addresses
####### Changed From Original Script END #######

# 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; }

####### Changed From Original Script #######
# obtain From address
from_address=`grep -m 1 "From:" in.$$ | cut -d "<" -f 2 | cut -d ">" -f 1`

if [ `grep -wi ^${from_address}$ ${DISCLAIMER_ADDRESSES}` ]; then
/usr/bin/altermime --input=in.$$ \
--disclaimer=/etc/postfix/disclaimer.txt \
--disclaimer-html=/etc/postfix/disclaimer.txt \
--xheader="X-Copyrighted-Material: Please visit http://www.company.com/privacy.htm" || \
{ echo Message content rejected; exit $EX_UNAVAILABLE; }
fi
####### Changed From Original Script END #######

$SENDMAIL "$@" exit $?

Afterwards change the group and the rights in order that altermime is allowed to execute the script.

Read More >>

No comments:

Post a Comment