On Sun, Sep 18, 2022 at 09:27:46AM +0200, Yvan Masson wrote:
> So the `mailutils` package with `mail` command is optional: `sendmail` could
> be used directly in scripts (but it might be a bit less practical to use,
> see for example https://www.computerhope.com/unix/usendmai.htm#examples).

If you call /usr/sbin/sendmail, you have to write all of the headers
yourself, with correct (or at least acceptably close) syntax.

The only time a shell script should be calling /usr/sbin/sendmail directly
is when you're trying to do something that your MUA (mailx, et al.) doesn't
allow, such as forging a bogus Date: header, or overriding the envelope
sender address.

In normal usage, scripts should always be calling mailx or an equivalent
program which is *designed* to create the e-mail headers correctly.  This
is especially true if you're sending attachments.  Writing the MIME headers
and attachment markup yourself is not going to be fun.

Reply via email to