wannannaw
13th August 2008, 20:41
I've just installed altermim in to our postfix e-mail server. And I'm seeing problems when I send out e-mails. Here's the rundown. I'm sending through thunderbird and outlook. When i send to HTML Only I don't recieve the disclaimer, when I send to txt I recieve the text disclaimer, when I send to html and text I see the html disclaimer (or text). But when I send HTML only it doesn't include the disclaimer html in the source anywhere like it's not being added. I did notice something weird in the headers. This is the html and txt content type (which works)
Content-Type: multipart/alternative;
boundary="------------040308060102020907020202"
This is the html content type (which doesn't)
Content-Type: text/html; charset=ISO-8859-1
Here's my setup. Maybe i'm overlooking something simple but please help.
/etc/postfix/disclaimer
#!/bin/sh
# Localize these.
INSPECT_DIR=/var/spool/filter
SENDMAIL=/usr/sbin/sendmail
disc_flag=0
###########changed from original script########
DISCLAIMER_ADDRESSES=/etc/postfix/disclaimer_addresses
#######end#########
# Exit codes from <sysexits.h>
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; }
########change from original script#########
#obtain from address
to_address=$(grep "To:" in.$$ | cut -d ":" -f 2|sed 's/, / /g')
SENDER=$(echo $* | awk '{print $2}' | tr [A-Z] [a-z])
for i in $to_address
do
to_dom=$(echo $i |cut -d "@" -f 2)
#if [ $(grep -ivc $to_dom ${DISCLAIMER_ADDRESSES}) -ge 1 ]; then
if [ $(echo $SENDER | grep -cie 'xxx.xxx@xxx.com$' -cie 'xxx.xxx@xxx.com$' -cie 'XXX.XXX@XXX.com$') -gt 0 ]; then
if [ $disc_flag -eq 0 ]; then
disc_flag=1
/usr/local/bin/altermime --input=in.$$ \
--disclaimer=/etc/postfix/filter/disclaimer.txt \
--disclaimer-html=/etc/postfix/filter/disclaimer.htm \
--htmltoo \
--force-for-bad-html \
--verbose \
--log-syslog \
--xheader="X-Copyrighted-Material: Please visit http://www.company.com/privacy.htm" || \
{ echo Message content rejected; exit $EX_UNAVAILABLE; }
fi
fi
#fi
done
#####end#######
$SENDMAIL -i "$@" < in.$$
exit $?
relevent master.cf file
smtp inet n - - - - smtpd
-o content_filter=spamassassin
-o content_filter=dfilt:
dfilt unix - n n - - pipe
flags=Rq user=filter argv=/etc/postfix/disclaimer -f ${sender} -- ${recipient}
Content-Type: multipart/alternative;
boundary="------------040308060102020907020202"
This is the html content type (which doesn't)
Content-Type: text/html; charset=ISO-8859-1
Here's my setup. Maybe i'm overlooking something simple but please help.
/etc/postfix/disclaimer
#!/bin/sh
# Localize these.
INSPECT_DIR=/var/spool/filter
SENDMAIL=/usr/sbin/sendmail
disc_flag=0
###########changed from original script########
DISCLAIMER_ADDRESSES=/etc/postfix/disclaimer_addresses
#######end#########
# Exit codes from <sysexits.h>
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; }
########change from original script#########
#obtain from address
to_address=$(grep "To:" in.$$ | cut -d ":" -f 2|sed 's/, / /g')
SENDER=$(echo $* | awk '{print $2}' | tr [A-Z] [a-z])
for i in $to_address
do
to_dom=$(echo $i |cut -d "@" -f 2)
#if [ $(grep -ivc $to_dom ${DISCLAIMER_ADDRESSES}) -ge 1 ]; then
if [ $(echo $SENDER | grep -cie 'xxx.xxx@xxx.com$' -cie 'xxx.xxx@xxx.com$' -cie 'XXX.XXX@XXX.com$') -gt 0 ]; then
if [ $disc_flag -eq 0 ]; then
disc_flag=1
/usr/local/bin/altermime --input=in.$$ \
--disclaimer=/etc/postfix/filter/disclaimer.txt \
--disclaimer-html=/etc/postfix/filter/disclaimer.htm \
--htmltoo \
--force-for-bad-html \
--verbose \
--log-syslog \
--xheader="X-Copyrighted-Material: Please visit http://www.company.com/privacy.htm" || \
{ echo Message content rejected; exit $EX_UNAVAILABLE; }
fi
fi
#fi
done
#####end#######
$SENDMAIL -i "$@" < in.$$
exit $?
relevent master.cf file
smtp inet n - - - - smtpd
-o content_filter=spamassassin
-o content_filter=dfilt:
dfilt unix - n n - - pipe
flags=Rq user=filter argv=/etc/postfix/disclaimer -f ${sender} -- ${recipient}