Message delivery rule for ooo-replies
Posted: Tue Dec 04, 2007 11:36 am
by a.sobieray
Hi experts,
I'd like to create a message delivery rule which suppresses out-of-office-replies to the internet for messages beeing received via distribution list.
Here's an example:
User A is member of distribution list DL.
User A activates his ooo-reply.
User A receives an e-mail from the internet, sent directly to his address. Then the ooo-reply should be sent to the internet.
User A receives an e-mail from the internet, sent to internet address of distribution list DL. In this case scalix should NOT send an ooo-reply to the internet.
Can this be managed by use of message delivery rules (or is there a better way to do) ?
Is there a possibility to distinguish between messages received directly for my internet-address and messages received as member of a distribution list (i.e. in mail header,...) ?
no way
Posted: Tue Dec 04, 2007 11:08 pm
by foton
No standard way you can do this. I ended up with crontab job to patch newly created ooo rules.
http://bugzilla.scalix.com/show_bug.cgi?id=15586
Definitely not the best implementation, but works for me
Code: Select all
#!/bin/sh
# You may want to run this script from crontab say every 3 hours
# omshowu -m all | while read PATCHUSER ; do echo "Patching user: $PATCHUSER"; /opt/scalix/bin/patchoof "$PATCHUSER" ; done
if [ "$1" == "" ]; then
echo "This script will add filter to the existing Scalix out-of-office rule to reply only if user's address is in TO or CC."
echo "Usage: $0 \"Scalix User Name\" [--unpatch]"
exit
elif [ "$1" == "--cycle" ]; then
echo "Cycle start"
/opt/scalix/bin/omshowu -m all | while read PATCHUSER ; do echo "Patching user: $PATCHUSER"; $0 "$PATCHUSER" $2 ; done
exit
fi
userfolder=`/opt/scalix/bin/omshowu -n "$1" -f|grep "User Folder"`
if [ "$userfolder" == "" ] ; then exit; fi
userfolder=`echo $userfolder| sed "s/User Folder : //"`
userfolder=`echo $userfolder| sed "s/\/00000v8:1//"`
userfolder=`/opt/scalix/bin/omrealpath $userfolder`
#echo User home folder is: $userfolder
MYTEMP=`mktemp`
MYTEMP_TOUCHED=`mktemp`
MYAA="$userfolder/000003d"
IS_EXIST=`/opt/scalix/bin/sxaa --user "$1" --info 501`
if [ "$IS_EXIST" == "" ]; then
echo "Sorry, no OOF rule 501 defined for user $1. Nothing to patch/unpatch"
exit
fi
/opt/scalix/diag/tfbrowse -w '%' -c -i $MYAA > $MYTEMP
#cat $MYTEMP
IS_PATCHED=`grep -A 1 "AA_NO (DN) 0x[1|0] 501" $MYTEMP |grep "SIMPLE_REPLY"`
case $2 in
--unpatch)
if [ "$IS_PATCHED" == "" ]; then
echo "Removing patch"
sed '
# search for rule 501 and delete filter lines
/AA_NO (DN) 0x[1|0] 501/ {;x;N;N;N;N;N;N;N
s/AA_NO (DN) 0x[1|0] 501.*\nFILTER_START (DN) 0x0 0x0 0\nFILTER_START (DN) 0x0 0x0 1\nFILTER_NUM (DN) 0x0 0x0 17 1 0 0 1\nFILTER_NUM (DN) 0x0 0x0 17 1 0 0 2\nFILTER_NAME (DN) 0x1 0x8000 3 1 0 0 "S=%A@B.COM%"\nFILTER_END (DN)\nFILTER_NAME (DN) 0x1 0x8000 3 1 0 0 "S=%robot@domain.COM%"\nFILTER_END (DN)//;x}
' $MYTEMP > $MYTEMP_TOUCHED
/opt/scalix/diag/tfbrowse -w '%' -g -i $MYTEMP_TOUCHED -o $MYAA
# cat $MYTEMP_TOUCHED
rm $MYTEMP_TOUCHED
else
echo "There was no patch"
fi
;;
*)
if [ "$IS_PATCHED" != "" ]; then
echo "Applying Scalix OOF patch"
sed '
# search for rule 501 and append filter lines
/AA_NO (DN) 0x[1|0] 501/ a\
FILTER_START (DN) 0x0 0x0 0\
FILTER_START (DN) 0x0 0x0 1\
FILTER_NUM (DN) 0x0 0x0 17 1 0 0 1\
FILTER_NUM (DN) 0x0 0x0 17 1 0 0 2\
FILTER_END (DN)\
FILTER_NAME (DN) 0x1 0x8000 3 1 0 0 "S=%robot@domain.COM%"\
FILTER_END (DN)
' $MYTEMP > $MYTEMP_TOUCHED
/opt/scalix/diag/tfbrowse -w '%' -g -i $MYTEMP_TOUCHED -o $MYAA
# cat $MYTEMP_TOUCHED
rm $MYTEMP_TOUCHED
else
echo "Already patched";
fi
;;
esac
rm $MYTEMP
Messages from
robot@domain.com address will be ignored by ooo too.