View Single Post
  #40 (permalink)  
Old 06-10-2009, 08:45 AM
maremester maremester is offline
New Member
 
Posts: 3
Default Solved...

Thanks anyway...but i solve the problem.
Here is my "disclaimer" script:
Code:
#!/bin/sh
INSPECT_DIR=/var/spool/filter
SENDMAIL=/opt/zimbra/postfix/sbin/sendmail
FOLDER_DISCLAIMER=/opt/zimbra/postfix/conf

# Exit codes from <sy***its.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; }

TEXT_DISCLAIMER=`grep "[a|A-z|Z]" ${FOLDER_DISCLAIMER}/disclaimer.txt | grep -v "_" | tail -2 | head -1`

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

nohup grep "${TEXT_DISCLAIMER}" in.$$ > /dev/null 2>&1

# Extract SENDTO Address(ex. "user@other_domain.com")
to_address=`grep -m 1 "To:" in.$$ | cut -d "<" -f 2 | cut -d ">" -f 1`

# Extract from SENDTO address only DOMAIN name(ex. "other_domain.com")
to_dom=`echo $to_address |cut -d "@" -f 2`

our_domain="YOURDOMAIN.COM"

# If OTHER_DOMAIN.COM(SENDTO domain) is not YOURDOMAIN.COM add disclaimer
# means that add disclaimer only for outgoing mail
# for internal mail you will not have disclaimer
if [ $to_dom != $our_domain ]; then
        /usr/bin/altermime --input=in.$$ \
                --disclaimer=${FOLDER_DISCLAIMER}/disclaimer.txt \
                --disclaimer-html=${FOLDER_DISCLAIMER}/disclaimer.html \
                --xheader="X-Copyrighted-Material: Please visit http://www.company.com/privacy.htm" || \
                { echo Message content rejected; exit $EX_UNAVAILABLE; }
fi

$SENDMAIL -i "$@" < in.$$

exit $?
You need to follow this article to get things right:
Adding a disclaimer (altermime) or footer - Zimbra :: Wiki excluding option 7a.
It's work only with one IP address.

Last edited by maremester : 06-10-2009 at 08:51 AM.
Reply With Quote