procmail
[Top] [All Lists]

Re: Resending using formail from the command line

2002-06-03 21:17:45
On Mon, Jun 03, 2002 at 12:02:37PM +0300, Udi Mottelo wrote:
straylight# formail -s /usr/sbin/sendmail < /var/mail/mdb
Recipient names must be specified


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

That's not the most efficient way of getting an error message I've ever seen,
but it will work.
1> There are much easier ways to pipe all files in a directory through another
program.
2> The path element seperators in your sendmail command will break your sed
command. If you need to use / in a sed substitution, try using ! to seperate
your sed elements instead. EG: "sed 's!.*!formail -s /usr/sbin/sendmail...!'"

Now, addressing point 1, you might try something more along the lines of

(In Bash. Other shells have similar methods)
cd /var/mail
for a in *; do
        formail -s /usr/sbin/sendmail < $a
done

However I wouldn't take a spool file and just feed it back through sendmail.
At the very least move the old spool out of the way, lest you end up appending
to the file you're reading from and create a nasty loop.

-- 
Andrew Edelstein        -       http://andrew.pure-chaos.com/resume.txt

Please do not reply directly to me, or Cc: me on a reply to a list message.
I'll get my copy from the list.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail