Score:0

Authenticated SMTP with sendmail on command line

us flag

we are sending emails using sendmail on the command line, with a command such as :

cat <email_contents> | sendmail -t

the <email_contents> contains fields such as sender, recipient etc.:

To: [email protected]
Subject: Testing
From: [email protected]

as well as a huge file, attachments etc.

we now need to use Authenticated SMTP (pass a login & password argument to authenticate against the SMTP server).

is there a way to do that with this method ? (using sendmail arguments or modifying the email_contents taking in consideration the following elements:

  1. NOT using mailx or any other mail client. we need to keep using sendmail from the commandline
  2. NOT amending the sendmail configuration files (sendmail.cf)

thanks again regards,

ar flag
bob
As the manual says ***"sendmail is not intended as a user interface routine"***. The ability 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 and upgrade your tools and practices as well. - Either use a more advanced mail submission agent or install and configure a local MDA (like sendmail) to do the more advanced stuff that the sendmail command can't do for you.
digijay avatar
mx flag
@bob please post this comment as an answer, it would be absolutely appropriate!
Score:2
ar flag
bob

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
olivierg avatar
us flag
Thank you for taking the time to answer.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.