beta.blog

Archive for September, 2025

Linux: Use sendmail to send multi-line emails

by on Sep.01, 2025, under News

On Linux we may use the sendmail command to send multi line emails as follows:

/usr/sbin/sendmail -v -t <<EOF
From: root@example.com
To: some.user@example.com
Subject: TEST via sendmail

This is a test message sent via sendmail at $(date).
EOF

The requirement is that we’ve an MTA (Mail Transfer Agent) installed on our box. For example:

  • postfix
    Postfix is an open‑source Mail Transfer Agent (MTA) for Linux (and other Unix‑like systems). Its purpose is to send, receive, route, and deliver email — both system‑generated mail (e.g. cron job output) and user mail.
  • ssmtp
    SSMTP (Simple SMTP) is a minimalist Mail Transfer Agent whose sole job is to forward outgoing mail to an external SMTP server. Unlike Postfix, SSMTP cannot receive, queue, or locally deliver mail — it simply hands off messages (e.g. cron jobs, system alerts) to another mail server (like Gmail, Office365, your corporate SMTP). Please note that SSMTP is unmaintained and removed from many distributions nowadays. Modern alternatives include msmtp or nullmailer for lightweight outbound‑only SMTP.
Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!