Say I receive a message with an attachment, and all I want to do is to resend this message to another address. Is it possible to do this using plain mailx? If so, how? I know Heirloom mailx has a resend command, but I was wondering if it is possible to achieve this result using more primitive versions of mailx.
Can I resend a message with (plain) mailx?
mailx
According to heirloom mailx's documentation:resend: Takes a list of messages and a user name and sends each message to the named user. 'Resent-From:' and related header fields are prepended to the new copy of the message.For a bare-bones way to achieve the same effect, you don't even need to use an MUA at all. You can just use the shell and pipes to submit the message directly to the MTA/MSP. So if you have the message (headers+body) located in a file called foo:(    echo Resent-From: your.email@address    cat foo) | /usr/lib/sendmail somebody@else.comNote that the MTA installed the system need not be Sendmail for this to work. /usr/lib/sendmail is just the defacto standard UNIX mail submission interface. Other MTAs like Postfix and exim provide /usr/lib/sendmail too.Also note that I did not take into account the related header fields mentioned in the documentation. I didn't check for I guess they are Resent-Date and things like that. If you know what they are and you care to include them, you can just add them as additional echo statements above.Finally, I'll note that even heirloom mailx has an additional mode called Resend (note capital R) documented as follows:Like resend, but does not add any header lines. This is not a way to hide the sender's identity, but useful for sending a message again to the same recipients.So if you actually want that, it's even simpler because you just submit the existing message as is:/usr/lib/sendmail somebody@else < foo