How can I pass a full raw/MIME message (raw file) to the Linux mailx command for delivery? I don't want to extract the recipient, subject, body etc from the message - I want to feed a complete existing raw mail message 'as is' to mailx for sending whilst retaining all existing headers.
An example message is as follows:
Received: (qmail 32389 invoked by uid 0); 13 Jun 2017 09:24:51 -0400 Date: Tue, 13 Jun 2017 09:24:51 -0400 From: email@example.com To: firstname.lastname@example.org Subject: Test Email Message-ID: <593fe7a3.IgSR+/BLy+NYXlVZemail@example.com> User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit The test mail content
So I want to be able to feed the above to the mailx command on the command line.
The purpose of this is to make the server deliver the original message (exactly as it was read from the raw message file) via a secondary SMTP server - to do this we would use mailx's -S switch to specify the secondary SMTP server eg:
mailx -S smtp="backup-mail-server.com:25" < feed in the MIME message here somehow
How can I do this with