Subject: Re: Can formail change destination and then resend???

From: [email-masked] (Stephen R. van den Berg)
Date: Tue, 21 Jun 1994 14:46:03 +0200

Elmar Kurgpold <[email-masked]> wrote:
>queued.  Or was it replies to those messages??  Anyways, I have a bunch 
>of messages with bogus addresses after the @ sign, like ekurgpol@badhost 
>instead of ekurgpol@goodhost.  That is the only substitution I would 
>need to make. 

>I was going to use formail anyways to resend all the mail, after adding
>"badhost" as a secondary hostname to "goodhost".  Can anyone think
>(quickly) of a way to bypass this step?  Since "badhost" is an actual
>system-- Ok, it's a networked printer, but in a critical area.  Actually,
>if someone could verify the proper usage of formail for resending
>messages after all the headers have been corrected, that would be great
>too. 

Without more specific info about what exactly needs to be corrected in
the header of those mails and in what format you have the messages now,
I'd say, the following should serve your purpose:

	sed -e 's/@badhost/@goodhost/g' <all_the_messages_in_one_file |
	 formail -s /usr/lib/sendmail -oi -t -odq

This puts them back in the queue again.

Then flush the queue with:	/usr/lib/sendmail -q &
You can repeat this last command if you'd like more messages to go
out concurrently.

-- 
Sincerely,                                  [email-masked]
           Stephen R. van den Berg (AKA BuGless).

Real programmers don't produce results, they return exit codes.