From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078708811704.tru64-unix-managers.marc@archive.invalid> From: Bruce Taube Date: Wed, 20 May 1998 13:35:40 +0000 To: tru64-unix-managers Subject: SUMMARY: resending mail X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078708811704 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@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.