3

Does anybody on this planet know what the equivalent GNU mailutils command to the following looks like? Is this even possible without a local MTA with mailutils? Using s-nail it works as intended.

s-nail -s "$subject" -S $smtp_server -r $from_user $to <<<$message

according to the GNU mailutils manual I tried:

mail --subject "$subject" \
 --set smtp=$smtp_server \
 --exec "set sendmail=smtp://$smtp_server" \
 --append "From:$from_user" \
 $to <<<$message

mail: Cannot open mailer: Input/output error
mail: cannot send message: Input/output error

this is not a duplicate of can-i-set-up-system-mail-to-use-an-external-smtp-server as they used a local MTA or heirloom-mailx or s-nail or other tools. I am using Debian.

terdon
  • 242,166

1 Answers1

1

got it.

on default mailutils mailer url (smtp://$smtp_server) uses startls. Found it using verbose mode:

mail --subject "$subject" \
 --exec "set sendmail=smtp://$smtp_server" \
 --exec 'set verbose' \
 --append "From:$from_user" \
 $to <<<$message

mail: S: 220 xxx ESMTP
mail: C: EHLO xxx
mail: S: 250-xxx
mail: S: 250-PIPELINING
mail: S: 250-SIZE 10240000
mail: S: 250-ETRN
mail: S: 250-STARTTLS
mail: S: 250-AUTH PLAIN LOGIN
mail: S: 250-ENHANCEDSTATUSCODES
mail: S: 250-8BITMIME
mail: S: 250-DSN
mail: S: 250 CHUNKING
mail: C: STARTTLS
mail: S: 220 2.0.0 Ready to start TLS
mail: C: EHLO xxx
mail: Cannot open mailer: Input/output error
mail: cannot send message: Input/output error

giving mailer url the notls parameter solves it:

mail --subject "$subject" \
 --exec "set sendmail=smtp://$smtp_server;notls" \
 --exec 'set verbose' \
 --append "From:$from_user" \
 $to <<<$message
  • I strongly recommand you or anyone who see this post, do not use smtp:// url with your username/password in url, or your password will be sent in plain text without tls encryption. Use the smtps:// url to secure your password. – gholk May 25 '23 at 12:20