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

Terminal Server or Remote Desktop Not listening on port 3389 after sysprepTerminal Server or Remote Desktop Not listening on port 3389 after sysprep

Remote Desktop Services is not accepting logons because setup is running.Log Name: Microsoft-Windows-TerminalServices-LocalSessionManager/OperationalSource: TerminalServices-LocalSessionManagerEvent ID: 34 If Sysprep is stuck or trying to run repeatedly, it might be necessary to