SUMMARY: resending mail

From: Bruce Taube <Bruce.Taube_at_InfoAve.Net>
Date: Wed, 20 May 1998 09:35:40 -0400 (EDT)

Original question:

> Does anyone know of a script (or method) that will loop through all
mailboxes in /var/spool/mail and resend each message to the same
recipient at another domain. I can't simply append the mailboxes
because the other server at the new domain is VMS and doesn't use
text mailboxes. I also don't want to send the entire mailbox as
one message.

Thanks to these folks for their rapid useful response:

Stephen Dowdy
Matthias E. Johnson
Allan E Johannesen
Nestor Ruiz
Lucio Chiappetti
Brian O'Neill

And special thanks to Charles M Richmond

There were several suggestions to use procmail/formail and several people sent
perl/shell scripts. I ended up using these simple MH commands (slightly
modified) that were suggested by Charles Richmond:

mkdir /var/tmp/spools # Make a copy of spools for safety sake.
cp /usr/spool/mail/* /var/tmp/spools/.

for mspool in /var/tmp/spools/* # mspool is the username which is
do # also the name of the spol file
folder +$mspool # You will have to manually answer 'y'
inc +$mspool -file /var/tmp/spools/$mspool
for msg in ~/Mail/$mspool/* # now loop through msg's
do
cat ~/Mail/$mspool/$msg | sendmail $mspool_at_newmachine.address
done
done

The above depends on the users having the same user name on both machines.
If you want to use a decnet type address on the sendmail ( machine::$mspool )
then you can.

Use the man pages for 'inc' and 'folder' and understand what you are doing,
so that you can tailor it to your circumstance if needed. The really nice
thing about the above is that it preserves the original date and sender
fields.
Received on Wed May 20 1998 - 15:42:45 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:37 NZDT