Vpopmail doesn't complicate things much. :)

I think you want to use the -Y switch, to get messages YOUNGER than 72h. Otherwise it will only show messages from 3 days ago, not new messages.

Also, because each person is in a different directory, that means you have to have a cron entry for each pop3 user.

Rather than have a new cron line for each pop3 user, I setup a bash script that will recursively go through directories and look for a ~/.tmdarc:

-------------------------begin file:
#!/bin/bash
FILE=/root/tmdausers
USERFILE=/root/tmdauser
MESSAGE=/root/message
DATE=`date`

send_report ()
{
USERFILE=/root/tmdauser
MESSAGE=/root/message
DATE=`date`
email="$1"
i="$2"
echo $email
echo "to: $email
from: [EMAIL PROTECTED]
subject: TMDA Daily Report for $email

Messages in queue as of $DATE:
" >> $MESSAGE
/usr/bin/tmda-pending -C -b -s -Y 48h -c $i >> $MESSAGE
echo "

--------
End TMDA Report

" >> $MESSAGE
cat $MESSAGE | /var/qmail/bin/qmail-inject
rm -f $MESSAGE
}

for i in /home/vpopmail/domains/*/*/.tmdarc
do
echo $i >> $USERFILE
addr=`cut -d/ -f6 $USERFILE`
domain=`cut -d/ -f5 $USERFILE`
email=$addr@$domain
# if [ "$email" != "[EMAIL PROTECTED]" ]
# then
send_report $email $i
# fi
rm -f $USERFILE
done
exit
-----------------------------end file

Commented out is a place where you can put user's emails that DONT want a report. This assumes that your vpopmail is in /home/vpopomail.

The just chmod 770 this script and add it to root's cronjob.

Now the .msgcache files will be owned by root, so to the script before the exit line I added:

---------------------begin:
for f in /home/vpopmail/domains/*/*/.tmda/pending/.msgcache
do
chown vpopmail:vchkpw $f
done
---------------------------- end

Which changes the ownership back to vpopmail. Im not sure this is needed, but it makes everything neat.

This will also create a nightly email to the root user, so make sure that you have the root email go somewhere that is checked, or set the MAIL environment var for cron. This is a great way for checking for tmda mis-configurations (like missing crypt_keys) as the email to root will have any errors that were found.

I also have a similar setup to remove messages from the pending dir.

Good Luck


At 16:06 1/28/2003 -0500, you wrote:
Before I spend a huge amount of time on this, will a cron job work to
email a pending report in a qmail/vpopmail setup?

just curious if everything running as vpopmail complicates matters much.
--Photocon
Conrad Hunziker III
http://www.NightSkyHosting.com
- FAQ: http://faq.NightSkyHosting.com
- Domain Account Manager: http://Manage.NightSkyHosting.com
_____________________________________________
tmda-users mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-users

Reply via email to