{"id":207,"date":"2007-01-10T15:58:00","date_gmt":"2007-01-10T15:58:00","guid":{"rendered":"https:\/\/ahm.basfinans.com\/index.php\/2007\/01\/10\/sending-email-from-the-command-line\/"},"modified":"2007-01-10T15:58:00","modified_gmt":"2007-01-10T15:58:00","slug":"sending-email-from-the-command-line","status":"publish","type":"post","link":"https:\/\/ahm.basfinans.com\/index.php\/2007\/01\/10\/sending-email-from-the-command-line\/","title":{"rendered":"Sending email from the command line"},"content":{"rendered":"<p><a href=\"http:\/\/2.bp.blogspot.com\/_MWBL1bjt7-k\/RaJqeTroR5I\/AAAAAAAAAFQ\/TEwfF9_l968\/s1600-h\/cygwin.PNG\"><img decoding=\"async\" style=\"margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;\" src=\"http:\/\/2.bp.blogspot.com\/_MWBL1bjt7-k\/RaJqeTroR5I\/AAAAAAAAAFQ\/TEwfF9_l968\/s320\/cygwin.PNG\" alt=\"\" id=\"BLOGGER_PHOTO_ID_5017690003756042130\" border=\"0\" \/><\/a>In developing automated scripts that scheduled to run periodically, I need to send email from inside the script to know about the script execution status and if there is any error. Here what I did to install, configure and test an email tool.<\/p>\n<p><span><br \/>Prerequisite:<br \/>&#8211; This is tested on Windows XP, sure it works on any Linux distribution.<br \/>&#8211; You should have cygwin, install from: <a href=\"http:\/\/www.cygwin.com\/\">http:\/\/www.cygwin.com\/<\/a><br \/>&#8211; It is important to be familiar with command line environment.<\/p>\n<p>Run the Cygwin tool, and select &#8220;email&#8221; tool, see the picture.<\/p>\n<p>After installation is complete, open the console and run:<br \/><span style=\"font-style: italic;\">$\/usr\/bin\/email-config<\/span><\/p>\n<p>You will get a series of questions and will have to type answers, like the SMTP server used to send email, and so on&#8230;<\/p>\n<p>After finish, you can easily edit your configuration, use:<br \/><span style=\"font-style: italic;\">$ nano  \/etc\/email\/email.conf<\/span><\/p>\n<p>You can edit your email signature file by:<br \/><span style=\"font-style: italic;\">$ nano  \/etc\/email\/email.sig<\/span><\/p>\n<p>Now you can send email very easily:<br \/>write your email text to the file mail.txt, as example:<br \/><span style=\"font-style: italic;\">$echo &#8220;this is a test email&#8221; >> mail.txt<\/span><br \/>Now send the emai by:<br \/><span style=\"font-style: italic;\">$email -s &#8220;my email subject&#8221;  myemail@mycompany.com <><\/p>\n<p>for email tool details, type:<br \/><span style=\"font-style: italic;\">$man email<\/span><\/span><\/p>\n<p><\/span><\/p>\n<div>From ahm507.blogspot.com<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In developing automated scripts that scheduled to run periodically, I need to send email from inside the script to know about the script execution status and if there is any error. Here what I did to install, configure and test an email tool. Prerequisite:&#8211; This is tested on Windows XP, sure it works on any [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"_links":{"self":[{"href":"https:\/\/ahm.basfinans.com\/index.php\/wp-json\/wp\/v2\/posts\/207"}],"collection":[{"href":"https:\/\/ahm.basfinans.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ahm.basfinans.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ahm.basfinans.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ahm.basfinans.com\/index.php\/wp-json\/wp\/v2\/comments?post=207"}],"version-history":[{"count":0,"href":"https:\/\/ahm.basfinans.com\/index.php\/wp-json\/wp\/v2\/posts\/207\/revisions"}],"wp:attachment":[{"href":"https:\/\/ahm.basfinans.com\/index.php\/wp-json\/wp\/v2\/media?parent=207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ahm.basfinans.com\/index.php\/wp-json\/wp\/v2\/categories?post=207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ahm.basfinans.com\/index.php\/wp-json\/wp\/v2\/tags?post=207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}