procmail
[Top] [All Lists]

Re: Resending using formail from the command line

2002-06-04 12:13:30
On Mon, 3 Jun 2002, Andrew Edelstein wrote:

On Mon, Jun 03, 2002 at 12:02:37PM +0300, Udi Mottelo wrote:

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...!'"


        Yes, this is the place to apologize about.  I had recognized my
        mistake as I hit the <send> ... it was too late and I hoped that
        the members here know something about scripts and sed.  In second
        thought I decided that it is not fair and it is not ethics to send
        corrupted stuff to the list.  I sent correction and improved line.


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

        There is a strike here in the campus the email is not continuously
        and I do not know if you already read my discussion about the "*"
        with David Tamkin.  However, David suggest (and right as usual) to
        forward the message directly to procmail instead of sendmail.

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.

        The original sender asked for moving the folders to the users
        HOME by formail -s.  I can imagine how to do it just with
        lockfile(1) and mv(1)


Bye,
 Udi



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