I have a user ("username") which has some mail in /var/share/mail/username (this is Solaris). The mail should have been forwarded, but for some reason has not been. Can the mail in the file above be somehow resent (re-received?) by sendmail or some process now that the user has configured /export/home/username/.forward?
You could probably use sendmail's "-t" option, to resend to all recipients shown in the mail headers. Or, if there's just the one recipient, you can always just explicitly supply them as a command line argument.
If the saved mail message has the mbox-style one-line mail header, you'd want to strip that off first...
tail -n +2 mbox | sendmail -t
Check your man page, though, in case Solaris has some alternative form of sendmail command installed.
Also, sendmail may give some kind of warning if you use the "-t" option and you're not invoking this as a user it considers trusted (and that is configuration dependent).
Gilbert
On 2023-04-11 9:35 a.m., Kevin McGregor wrote:
I have a user ("username") which has some mail in /var/share/mail/username (this is Solaris). The mail should have been forwarded, but for some reason has not been. Can the mail in the file above be somehow resent (re-received?) by sendmail or some process now that the user has configured /export/home/username/.forward?
On 2023-04-11 Gilbert Detillieux wrote:
You could probably use sendmail's "-t" option, to resend to all recipients shown in the mail headers. Or, if there's just the one recipient, you can always just explicitly supply them as a command line argument.
If Kevin means the path named is a text file in mbox format containing multiple emails then sendmail will not work. It will just (at best) send the first email in the mbox.
You might have to split the mbox file into multiple files (I'd do a perl -ne oneliner), then use whatever to resend each email individually. Just plain "mail" can be useful for some things; as can formail if you need to manipulate headers.
If there's not too many emails, you can always mutt -f the mbox file and use "b" to "bounce" the emails to the real recipient. Put the destination email address in your X cut buffer and just hit shift-insert after b. Heck, put the entire "b the@email.com enter" into a nano cut buffer and hit shift-insert X times to go through the whole thing. Might be faster than figuring out the command lines (though not as satisfying).