{"id":175,"date":"2013-08-28T21:07:00","date_gmt":"2013-08-28T21:07:00","guid":{"rendered":"http:\/\/204@jodohost.com\/\/blog\/"},"modified":"2013-08-28T21:07:00","modified_gmt":"2013-08-28T21:07:00","slug":"sending-email-in-linux-using-the-echo-command","status":"publish","type":"post","link":"http:\/\/www.jodohost.com\/blog\/index.php\/2013\/08\/28\/sending-email-in-linux-using-the-echo-command\/","title":{"rendered":"Sending email in Linux using the &quot;echo&quot; command"},"content":{"rendered":"<p>Sometimes we need to send an email from the server to test the mail delivery from the server and if we don&#8217;t have any user\/domain to send the email via authentication.<\/p>\n<p>In that case, we can use the &#8220;echo&#8221; command to send the email from the root to the outside domain or email id. Below is the syntax which can be used to send the email :-<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>echo &#8220;Mail Body&#8221; | mail -s &#8220;Subject of Mail&#8221;\u00a0 email@domain.tld<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>Also, we can send email from the command line with an attachment like below :-<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>echo \u201cMail Body\u201d | mutt -a attachment.zip -s \u201cSubject of mail\u201d xyz@domain.tld<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>That&#8217;s it.<\/p>\n<p> ]]><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes we need to send an email from the server to test the mail delivery from the server and if we don&#8217;t have any user\/domain to send the email via authentication. In that case, we can use the &#8220;echo&#8221; command to send the email from the root to the outside domain or email id. Below [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/175"}],"collection":[{"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=175"}],"version-history":[{"count":0,"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/175\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=175"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}