If I have the full contents of a MIME message, what is the best utility on Linux to send the message? The MIME message would include the full headers and mail body, for example:
Received: (qmail 32389 invoked by uid 0); 13 Jun 2017 09:24:51 -0400
Date: Tue, 13 Jun 2017 09:24:51 -0400
From: root@test.server.com
To: test@test.com
Subject: Test Email
Message-ID: <593fe7a3.IgSR+/BLy+NYXlVZ%root@test.server.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 mail body goes here
I want to be able to feed the above to a command line utility which will then re-process the message exactly 'as is' without having to parse fields such as sender, subject, etc. It should send the message through a specified external SMTP server (not the local server's mail queue).
What command line utility can I use for this purpose?
Best Answer
You may use
sendmail
or "sendmail look alike" provided by postfix/exim/... .-i
- do not treat lines with leading dot speciallyYou may use more exotic "sendmail look alike" (e.g. provided by
msmtp
) to send directly via another smtp host without "system wide" configuration.msmtp
is distributed in debian so it is likely to be included in other linux distributions.https://packages.debian.org/stretch/msmtp