I have a system running 15.0 with Internet access. Every so often this
system must send terse email notifications, as invoked from a cron job.
It is not going to receive any emails.
Any suggestions on how to do this without having to get sendmail
configured and running? This would amount to using an email client that
does not require a local sendmail, like e.g. Thunderbird. This is of
course not a an option: I need something that is command-line oriented
and lightweight.
Well, as it turns out to be the case spookily often, I figured it
out minutes after I posted this. In case anybody might be interested:
I created a file named .mailrc in the home directory for the user
who is going to be sending the emails, with the following contents in
this file:
# Testing syntax:
# echo "Testing, Testing, Testing" | mailx -s "My test..."
# ***@whatever.com
# Use v15.0 compatibility mode
set v15-compat
# See the whole process, especially for troubleshooting:
set verbose
# Essential setting: select allowed character sets
set sendcharsets=utf-8,iso-8859-1
# and reply in the same charset used by sender:
set reply-in-same-charset
# Default directory where we act in (relative to $HOME)
set folder=mail
# You actual address to reply to:
set from="***@myaddress.com"
# Request strict TLS transport layer security checks
# set tls-verify=strict
# set tls-ca-file=/etc/ssl/certs/ca-certificates.crt
# set tls-ca-no-defaults
# Alternative, don't do SMTP server certificate verification
set tls-verify=ignore
set smtp-use-starttls
set smtp-auth=login
# When sending messages, wait until the Mail-Transfer-Agent finishes.
# Only like this you will be able to see errors reported through the
# exit status of the MTA (including the built-in SMTP one)!
set sendwait
# And of course put your own username and password here in the obvious
# places:
set mta=smtps://USERNAME:***@SMTP.SERVER:465
With this, a simple invocation as mentioned at the top of the
file sends the email as expected. In my case, I disable TLS security
checks because I know what the SMTP server that will be connecting to is,
and that's the only server that I will be using here. All this suffices
to fulfill my needs.