moduleHSH.Helpers.EmailwhereimportHSHimportHSH.Helpers.UtilsimportText.StringTemplate.HelpersnewtypePureInput=PureInput{unpureinput::String}deriving(Read,Show){- |
Send an email via mailx.
For sysadmin steps required for this command to work with most of the work outsourced to gmail, see last three posts in thread
http://groups.google.com/group/HAppS/browse_thread/thread/93317d4d7317040f/14cd89d98f1f4041 This assumes a unixy environment,
-}mailxEmail::String->String->[Char]->IO(EitherString())mailxEmailemailBodysubject""=return.Left$"no email recipient"mailxEmailemailBodysubjectrecipient=tryS$runIO$echoemailBody-|-mailxCommandwheremailxCommand=render1[("subject",subject),("recipient",recipient)]"mailx -s \"$subject$\" $recipient$"