Sending email from the Linux command line

To configure BMC Discovery to send email see Configuring mail settings.

Independently of BMC Discovery you can also configure an appliance to send email automatically. For example, you might want the output of a script emailed to a recipient. To do this, you must use the Linux command line.

Versions of BMC Discovery earlier than 23.3 have shipped with the mailx utility. The s-nail utility replaces mailx.

 The s-nail utility replaces mailx. The mailx command is aliased, since the September 2023 OSU, to s-nail, so scripts from earlier versions should work without modification.

To send an email from the Linux command line

To send an email from the Linux command line, pipe the email body into the s-nail command. For example to email the contents of a file:

cat filename | s-nail -s "subject" -S from="from-address" -S smtp="smtp-server" to-address


Other useful options

-S smtp-use-starttls

-S ssl-verify
-S smtp-auth=login

-S smtp-auth-user=username

-S smtp-auth-password=password


Example usage

To send a copy of the /etc/motd file:

cat /etc/motd | s-nail -s "Today's message" -S from="discovery@noreply.bmc.com" \
                            -S smtp="smtp://smtpserver.bmc.com" recipient@bmc.com




Was this page helpful? Yes No Submitting... Thank you

Comments