{"id":2933,"date":"2025-04-21T15:55:54","date_gmt":"2025-04-21T13:55:54","guid":{"rendered":"https:\/\/itsimple.info\/?p=2933"},"modified":"2025-04-21T15:56:07","modified_gmt":"2025-04-21T13:56:07","slug":"how-to-send-email-with-s-nail-from-linux-command-line","status":"publish","type":"post","link":"https:\/\/itsimple.info\/?p=2933","title":{"rendered":"How to send email with s-nail from linux command line"},"content":{"rendered":"\n<p>S-nail is the new command line utility to send email replacing mailx <\/p>\n\n\n\n<p>to install :<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">dnf install s-nail<\/pre>\n\n\n\n<p>the correct way is to setup the configuration files, for general use (you can edit the file with nano or vi):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/etc\/s-nail.rc<br><\/pre>\n\n\n\n<p>For user cpecific settings use:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> ~\/.mailrc<\/pre>\n\n\n\n<p>here is a sample configure option :<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">set v15-compat<br>set smtp-auth=none  (could be: none, login, plain)<br>set smtp-auth-user=\"smtp_user_name\"<br>#set smtp-auth-password=\"smtp_password\"<br>set mta=smtp:\/\/smtp_server_ip_or_fqdn:port<br>set from=\"from_address@your_domain.com\"<br>set use-from<br>#set starttls (if the server required tls, the port will need to be diffrent 587 or 465, also the mta should be mta=smtps:\/\/....)<br><\/pre>\n\n\n\n<p>After configuration is complete, you will be able to send emails from command line, for example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">echo \"Message body\" | s-nail -s \"Subject line\" recipient@example.com<br><\/pre>\n\n\n\n<p>Adding -v will add debug option giving more details in case of error :<\/p>\n\n\n\n<p>echo &#8220;Message body&#8221; | s-nail -v -s &#8220;Subject line&#8221; recipient@example.com<\/p>\n\n\n\n<p>Remember to set all the necessary DNS record to allow sending correctly, settings like SPF &amp; DMARC<\/p>\n\n\n\n<figure class=\"wp-block-pullquote has-vivid-green-cyan-color has-text-color has-link-color has-large-font-size wp-elements-913a8d28a4fab8f1d7b7023910a23e04\"><blockquote><p>Good Luck<\/p><\/blockquote><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>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-compatset [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,13,21,4,12],"tags":[],"class_list":["post-2933","post","type-post","status-publish","format-standard","hentry","category-centos","category-linux","category-operating-systems","category-tech","category-tutorials"],"_links":{"self":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts\/2933","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2933"}],"version-history":[{"count":1,"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts\/2933\/revisions"}],"predecessor-version":[{"id":2934,"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts\/2933\/revisions\/2934"}],"wp:attachment":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2933"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2933"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2933"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}