Sending Test Email in AlmaLinux 8/9 From Command Line Interface (CLI) Using S-nail
INTRODUCTION
In AlmaLinux 8 and 9, along with Red Hat Enterprise (RHEL) Linux 8/9, and clones, sending emails through the command line can be accomplished using S-nail, a feature-rich implementation of the mailx command.
S-nail has also replaced mail and mailx.
But aliases those commands, so existing scripts should still work.
READ ME FIRST
This article is provided as a courtesy.
Installing, configuring, and troubleshooting third-party applications is outside the scope of basic support provided by Starburst Services.
We are not liable for any damages and/or data loss.
REQUIRMENTS
- SSH credentials or File Manager access Logged In as Root
- S-nail
PREREQUISITES
Before you proceed, ensure that s-nail is installed on your system:
dnf install s-nail
Sending a Test Email
Now, you can send a test email using the s-nail
command to an receiver email account:
echo "Test message" | s-nail -s "Test Email Subject" email_address
- echo “test message”: This is the emails body text
- s-nail: CLI mail program
- -s “Test Email Subject”: Specifies the subject of the email.
- email_address: Specifies the recipient email address.
Replace email_address
with your email address. For example:
echo "Test message" | s-nail -s "Test Email Subject" [email protected]
By Default the email will come from your servers root, using @server hostname, e.g. [email protected]
So if your server does not have a correct rDNS FQDN, this also can cause problems.
SUMMARY
While the command line emails clients are a lot simpler and less computationally intensive, you can only use them to send email to personal email domains and not to Gmail or Yahoo domains because of extra authentication required.
Also, you cannot receive emails from External SMTP servers.
Thanks for learning with Starburst Services.
Did you found this Knowledge Base Article useful?
Please considering thanking our SysOp Team.
KB Article Created: 2024-06-27
KB Article Updated: 2024-07-12