After changing the IP of a server that was configured as a satellite email system I missed to update mynetworks
on the mail server to allow the sending of emails on behalf of the new IP address.
That's why lots of emails were written to /var/spool/mail/ in the last week with a soft bounce notification Undelivered Mail Returned to Sender until we noticed this problem and fixed the mailserver configuration.
Now we want to redeliver the bounced emails to the original receivers. This means to parse the files at /var/spool/mail/* and extract the original emails to send them with original headers again. How to do that?
Best Answer
I wrote a PHP script to parse a /var/spool/mail/ file to resend bounced emails with original headers. Please be aware to change the configuration in the first lines to your needs.