View Single Post
  #6 (permalink)  
Old 06-09-2009, 04:41 AM
uxbod uxbod is offline
Moderator
 
Posts: 7,911
Default

There is a problem with the WiKi page so the script got munged ... try the following instead
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
  
if [ ! "$?" = 0 ]; 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 $?
__________________

Last edited by uxbod; 06-09-2009 at 05:04 AM.. Reason: remove line continuation tags
Reply With Quote