Authenticated SMTP with sendmail on command line

Solution 1:

As the manual says

"sendmail is not intended as a user interface routine".

The capabilities of the sendmail command to send mail stopped evolving well before SMTP authentication was invented.

When your environment is moving out of the stone-age and starts requiring newfangled technology like authentication and TLS, then you will need to get rid of your rocks to keep up.

Your options are exactly what you don't want to do, and you will need to upgrade your tools and practices to keep up with the times:

  • Either use a more advanced mail submission agent such as for example
    • mailx
    • the "drop in" sendmail command replacement ssmtp that does have smtp auth support.
    • or others.
  • install and configure a local MDA (like sendmail, postfix, exim etc.) to do the more advanced stuff that the sendmail command can't do for you and keep using the sendmail command