procmail
[Top] [All Lists]

Re: Resending using formail from the command line

2002-06-03 11:45:42
Michelle had asked,

< I'm trying to resend some mail that was mistakenly delivered to
< /var/mail/<user> instead of ~<user>/.mail before I got procmail
< completely configured to deliver mail to spools in users' home
< directories.

And Udi suggested,

cd /var/mail
/bin/ls | sed 's/.*/formail -s /usr/sbin/sendmail & < &/' | sh

Noticing the slash problem, Udi revised that to this:

| /bin/ls -d | sed -n 's,^[a-z0-9][a-z0-9]*$,formail -s /usr/sbin/sendmail -i
&
| < &,p' | sh

Even so, it shouldn't take all the uses of ls, sed, and sendmail.

#!/bin/sh
cd /var/mail
for user in *
do
  [ -s $user ] && formail -s procmail -d $user < $user
done

Since you are already running that script as root in order to read all the
users' mail spools, you can use procmail's -d option even if procmail is not
setuid root.



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail