Ran into an issue at work, where we had to reprocess all e-mails for a particular user on a Linux server. The email was stored in the standard mailbox format in /var/mail and all the e-mail was supposed to be sent to a different e-mail address. Here’s how we solved the issue
1) Use formail to split the mailbox into seperate messages and pipe it to sendmail. Command used was
formail -Y -n -s� sendmail -odq NAME_OF_USER < /var/mail/NAME_OF_USER
2) Force sendmail to process the queue and send the e-mail to the new address. Command used was
sendmail -v -qRNEW_EMAIL_ADDRESS
You can also edit the .forward file in the users home directory to forward e-mail to the new address and then you don’t have to specify the new e-mail address in the second command.