#!/bin/sh #---------------------------------------------------------------------------------- # /var/install/bin/antispam-read-messages - read spam messages # # Copyright (c) 2001-2024 The Eisfair Team, team(at)eisfair(dot)org # # Creation: 2002-12-01 jed # Last Update: $Id$ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------------- # read eislib . /var/install/include/eislib #exec 2>/tmp/antispam-read-messages-trace-$$.log #set -x pgmname=`basename $0` tmpfile=`/bin/mktemp -t ${pgmname}.XXXXXXXXX` username='spam' # create temporary file cat > ${tmpfile} << EOF #!/bin/sh boxname=`/var/install/config.d/antispam.sh --check4spam | sed 's|^.*total in *\(.*\)$|\1|'` if [ -n "\${boxname}" ] then num_msgs=`/var/install/config.d/antispam.sh --check4spam | sed 's|^.* \([0-9]*\) total in.*$|\1|'` if [ \${num_msgs} -gt 0 ] then /usr/bin/mail -f "\${boxname}" else echo "No mail for user '${username}' found." fi else echo "The spam mailbox doesn't exist." fi EOF chown ${username} ${tmpfile} chmod +x ${tmpfile} clrhome mecho --info "Reading ${username} mails" mecho #======================================================================================== # Main #======================================================================================== mecho mecho "The simple unix 'mail' program will be used to read the messages." mecho "Use the following commands to navigate or enter 'help' to show this help screen." mecho mecho "Most common mail commands:" mecho mecho " (d)elete Takes a list of messages as argument and marks them all as deleted." mecho " (f)rom Takes a list of messages as argument and prints their message header." mecho " (h)eaders Lists the current range of headers, which is an 18-message group." mecho " Use '+' or '-' argument to list next/previous 18-message group." mecho " (m)ail Takes as argument login names and sends mail to these people." mecho " (n)ext Goes to the next message in sequence and types it." mecho " (p)rint Takes a message list and types out each message on the user's terminal." mecho " (q)uit Quit program and leave unresolved messages in mailbox." mecho " (r)eply Takes a message list and sends mail to the sender and all recipients" mecho " of the specified message. The default message must not be deleted." mecho " (u)ndelete Takes a list of messages as argument and marks them all as not being" mecho " deleted." mecho " (x)it Exit program without removing system mailbox." mecho mecho " help or ? Display help screen." mecho if /var/install/bin/ask "Continue" then su - ${username} -s /bin/sh -c "${tmpfile}" fi rm -f "${tmpfile}" echo anykey