mars-mail/ohpostme

37 lines
1.0 KiB
Plaintext
Raw Permalink Normal View History

2011-11-13 00:46:51 +01:00
#!/bin/bash
2011-11-13 00:46:51 +01:00
#
2011-11-13 00:46:51 +01:00
#
# This script runs through all the user dirs to collect mail that needs to
# be sent.
# Pegasus mail for dos will use a gateway that places outgoing mail in
# /home/username/pmail/out. All these messages will be picked up by this
# script and mailed out.
# Please create a file /etc/ohmaillist that contains valid users that
# may send mail from dos pmail logged into mars.
# (I added it to the adduser script so all users can have new mail)
# Format of the ohmaillist file is just a single username per line
# Replace with the base dir of your home directories i.e. /home
homedirs="/hamster/home"
# Replace with your domain name
dm="eng.rau.ac.za"
2011-11-13 00:46:51 +01:00
while [ true ] ;
do
cd /hamster/home
for l in `cat /etc/ohmaillist`
do
for x in `ls $l/pmail/out`
do
2011-11-13 00:46:51 +01:00
cat "$l/pmail/out/$x" | sed "1,4d" | /usr/sbin/sendmail -f "<$l@$dm>" -t
2011-11-13 00:46:51 +01:00
rm "$l/pmail/out/$x"
echo "`date` -- Mail message $x send from $l mailbox" >> /var/log/ohpostme.log
done
sleep 1
done
2011-11-13 00:46:51 +01:00
sleep 7
2011-11-13 00:46:51 +01:00
done
2011-11-13 00:46:51 +01:00
# ohmail - ends here