I have email files in my Maildir received with postfix server (Ubuntu). Is there a utility that can forward a selected email file to the specified email address? Something like:
cat emailfile | utility to@address.com
I tried to use mail command but it just sent the entire file contents including all technical header information as a plain text, which does not look nice.
cat emailfile | mail -s subject to@address.com
Update
Sorry for not being specific. What I wanted is to forward an email file from a shell script, without attachments, but removing all the header and metadata and presenting it in human-friendly way. Like in gmail, when you click 'forward' it automatically parses the email nicely, adds "forwarded message" text on the top and then puts the body text message. I know I can parse the email file myself and construct a new email, but I thought there was a utility that could save me couple hours.
Best Answer
There are more possibilities than one.
cat emailfile | sendmail -f to@address.com
. Maybe you have to rewrite the mail before, as this does not "forward" the mail, but instead "send" the mail.*_alias_maps