It`s simple when you know how ! CentOS,Linux,Operating Systems,Tech,Tutorials How to send email with s-nail from linux command line

How to send email with s-nail from linux command line

S-nail is the new command line utility to send email replacing mailx

to install :

dnf install s-nail

the correct way is to setup the configuration files, for general use (you can edit the file with nano or vi):

/etc/s-nail.rc

For user cpecific settings use:

 ~/.mailrc

here is a sample configure option :

set v15-compat
set smtp-auth=none (could be: none, login, plain)
set smtp-auth-user="smtp_user_name"
#set smtp-auth-password="smtp_password"
set mta=smtp://smtp_server_ip_or_fqdn:port
set from="from_address@your_domain.com"
set use-from
#set starttls (if the server required tls, the port will need to be diffrent 587 or 465, also the mta should be mta=smtps://....)

After configuration is complete, you will be able to send emails from command line, for example:

echo "Message body" | s-nail -s "Subject line" recipient@example.com

Adding -v will add debug option giving more details in case of error :

echo “Message body” | s-nail -v -s “Subject line” recipient@example.com

Remember to set all the necessary DNS record to allow sending correctly, settings like SPF & DMARC

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

You can’t access this shared folder because your organization’s security policies block unauthenticated guest accessYou can’t access this shared folder because your organization’s security policies block unauthenticated guest access

  When trying to access from new server to old shares you might get this error : ” You can’t access this shared folder because your organization’s security policies block