Zimbra Disclaimer Issue Dear Experts,
I have installed Zimbra Mail server Disclaimer in my domain,
whenever i send mails to other domains, it should show the disclaimer. if i send mails to internal mail ids, it should not show disclaimer. The problem is: If i send mail to both internal and external domain (For Example: TO: External Domain & CC: Internal Domain), Its show the disclaimer to internal domain mails.
Can any one of you help / guide me, How to set disclaimer to work only for external Domain mails.
P.S: For your kind information, I am using following script for Disclaimer.
#!/bin/sh
INSPECT_DIR=/var/spool/filter
SENDMAIL=/opt/zimbra/postfix/sbin/sendmail
FOLDER_DISCLAIMER=/opt/zimbra/postfix/conf
DOMAIN="example.com"
# 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; }
TEXT_DISCLAIMER=`grep "[[:alnum:]]" ${FOLDER_DISCLAIMER}/disclaimer.txt | grep -v "_" | tail -4 | head -1`
cat > in.$$ || { echo Cannot save mail to file; exit $EX_TEMPFAIL; }
# Verify if is there the disclaimer present in the mail body
grep -q "${TEXT_DISCLAIMER}" in.$$
let R1="$?"
# Verify if the sender is from DOMAIN
#grep "From:" in.$$ | head -1 | grep -i $DOMAIN > /dev/null 2>&1
echo "$2" | grep -i -q "$DOMAIN"
let R2="$?"
# Verify if the recipient is from DOMAIN
echo "$4" | grep -i -q "$DOMAIN"
let R3="$?"
if [[ $R1 != 0 && $R2 == 0 && $R3 != 0 ]]; then
/usr/bin/altermime --input=in.$$ \
--disclaimer=${FOLDER_DISCLAIMER}/disclaimer.txt \
--disclaimer-html=${FOLDER_DISCLAIMER}/disclaimer.html || \
{ echo -e \n Message content rejected; exit $EX_UNAVAILABLE; }
fi
$SENDMAIL -i "$@" < in.$$
exit $?
Thanks and Regards
Krishna Moorthy
Last edited by phoenix; 01-11-2011 at 06:21 AM..
|