How to send raw mail message on Linux?

You may use sendmail or "sendmail look alike" provided by postfix/exim/... .

/usr/sbin/sendmail -i -- $recipients < message_file

-i - do not treat lines with leading dot specially

You 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.

Package: msmtp (1.6.6-1)
light SMTP client with support for server profiles

msmtp is an SMTP client that can be used to send mails from Mutt and probably other MUAs (mail user agents). It forwards mails to an SMTP server (for example at a free mail provider), which takes care of the final delivery. Using profiles, it can be easily configured to use different SMTP servers with different configurations, which makes it ideal for mobile clients.

Unfortunately sendmail and mailx do not allow you to specify a different SMTP server. But you could combine the answer from Andrzej with ssh. Although I will use the -t option to read recipients from the file/data being read.

cat <messagefile> | ssh user@mailhost /usr/sbin/sendmail -i -t

<messagefile> is a file containing the MIME message and mailhost is the SMTP server. user is a login id on the SMTP server.