This seems like it should be fairly easy to do, but I've run into a few problems.
I've added a cron job to parse all users whose UID is greater than 5000:
* * * * * root /usr/bin/test /etc/passwd -nt ~allusers/.forward \
&& /bin/egrep '([5-9]|[0-9]{2})[0-9]{3}' /etc/passwd | /bin/grep -v 65534 \
| /bin/cut -d ':' -f 1 > ~allusers/.forward
Then I created a .procmailrc file:
VERBOSE=yes
LOGFILE=/var/log/procmailrc
#Allow only certain users to send
:0
* ^From.*
[email protected].*
{}
:0E
/dev/null
But, the .forward file is processed before it even gets to procmail, evidently. If I moved the .forward file to another filename, can I use it in procmail to send an email to the users in this file?