/usr/sbin/kopano-autorespond is in kopano-dagent 8.5.5-0ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | #!/bin/sh
FROM=$1
TO=$2
SUBJECT=$3
USER=$4
MSG=$5
# defaults
self="${0##*/}"
AUTORESPOND_CC=0
AUTORESPOND_NORECIP=0
TIMELIMIT=$((24*60*60))
BASE_PATH=/var/lib/kopano/autorespond
SENDDB=$BASE_PATH/vacation-$USER.db
SENDDBTMP=$BASE_PATH/vacation-$USER-$$.tmp
SENDMAILCMD=/usr/sbin/sendmail
SENDMAILPARAMS="-t -f"
if [ -r /etc/kopano/autorespond ] ; then
. /etc/kopano/autorespond
fi
if [ ! -d "$BASE_PATH" ] ; then
/usr/bin/logger -p mail.notice -t "$self" "Created directory $BASE_PATH"
mkdir -p "$BASE_PATH"
chmod 750 "$BASE_PATH"
/usr/bin/logger -p mail.notice -t "$self" "Moving existing vacation files from /tmp to $BASE_PATH"
mv -fv /tmp/kopano-vacation-* "$BASE_PATH/"
fi
# Check whether we want to respond to the message
RESPOND=0
if [ "$AUTORESPOND_NORECIP" = "1" ]; then
RESPOND=1
elif [ "$AUTORESPOND_BCC" = 1 -a "$MESSAGE_BCC_ME" = "1" ]; then
RESPOND=1
elif [ "$AUTORESPOND_CC" = "1" -a "$MESSAGE_CC_ME" = "1" ]; then
RESPOND=1
elif [ "$MESSAGE_TO_ME" = "1" ]; then
RESPOND=1
fi
if [ $RESPOND -ne 1 ]; then
exit 0;
fi
# Subject is required
if [ -z "$SUBJECT" ]; then
SUBJECT="Autoreply";
fi
# not enough parameters
if [ -z "$FROM" -o -z "$TO" -o -z "$USER" -o -z "$MSG" ]; then
exit 0;
fi
if [ ! -f "$MSG" ]; then
exit 0;
fi
# Loop prevention tests
if [ "$FROM" = "$TO" ]; then
exit 0;
fi
shortto=`echo "$TO" | sed -e 's/\(.*\)@.*/\1/' | tr '[A-Z]' '[a-z]'`
if [ "$shortto" = "mailer-daemon" -o "$shortto" = "postmaster" -o "$shortto" = "root" ]; then
exit 0;
fi
shortfrom=`echo "$FROM" | sed -e 's/\(.*\)@.*/\1/' | tr '[A-Z]' '[a-z]'`
if [ "$shortfrom" = "mailer-daemon" -o "$shortfrom" = "postmaster" -o "$shortfrom" = "root" ]; then
exit 0;
fi
# Check if mail was send in last $TIMELIMIT timeframe
TIMESTAMP=`date +%s`
if [ -f "$SENDDB" ]; then
while read last to; do
if [ "$TO" != "$to" ]; then
continue
fi
if [ $(($last+$TIMELIMIT)) -ge $TIMESTAMP ]; then
exit 0;
fi
done < "$SENDDB"
fi
umask 066
grep -v "$TO" "$SENDDB" > "$SENDDBTMP" 2>/dev/null
mv "$SENDDBTMP" "$SENDDB" 2>/dev/null
echo $TIMESTAMP "$TO" >> "$SENDDB" 2>/dev/null
$SENDMAILCMD $SENDMAILPARAMS "$FROM" < "$MSG"
|