Zimbra

From RARForge
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Train Spam

Allow user to move Spam Message to a Imap Folder. Zimbra will auto train messages as SPAM and purge them hourly

  • Example user: 'user@baddomain.local'
  • User Must have a folder 'Spam'
  • add to /etc/crontab (used this instead of "su -c zimbra - 'crontab -e'" to maintain cron on upgrades)
42 *    * * *   zimbra /opt/zimbra/bin/zmtrainsa user@domain.local spam spam >> /opt/zimbra/log/spamtrain_rr.log 2>&1

Modify: /opt/zimbra/bin/zmtrainsa

INFO: Not required. However, this will purge the SPAM folder during the cron run. If this is not modified, the messages will stay in the SPAM folder until the user deletes them.

function: trainAccountFolder(...
 # append:
 ## robs addition. purge user folder if mode is spam                                                                                                
 if [ "x${MODE}" = "xspam" ]; then
  timestampit "START: Purging $USER mode:${MODE} folder:$FOLDER"
  mydir=`mktemp -d -t cleanup.XXXXXX` || exit 1
  ${zimbra_home}/libexec/zmspamextract -r -m $USER -o ${tempdir} -q in:${FOLDER} -d
  /bin/rm -rf ${mydir}
  timestampit "DONE: Purging $USER mode:${MODE} folder:$FOLDER"
 fi
}