-- | Quick, hacky sendmail wrapper
module Sihemo.Sendmail
    ( sendmail
    ) where

import System.Process (readProcess)

sendmail :: String    -- ^ Recipient
         -> String    -- ^ Subject
         -> [String]  -- ^ Content (lines)
         -> IO ()     -- ^ Blocks until mail is sent
sendmail recipient subject body = do
    _ <- readProcess "/usr/sbin/sendmail" [] $ unlines $
        [ "To: " ++ recipient
        , "Subject: " ++ subject
        , "Content-Type: text/plain"
        , ""
        ] ++ body
    return ()

-- | Quick, hacky sendmail wrapper
module Sihemo.Sendmail
    ( sendmail
    ) where

import System.Process (readProcess)

sendmail :: String    -- ^ Recipient
         -> String    -- ^ Subject
         -> [String]  -- ^ Content (lines)
         -> IO ()     -- ^ Blocks until mail is sent
sendmail recipient subject body = do
    _ <- readProcess "/usr/sbin/sendmail" ["-t"] $ unlines $
        [ "To: " ++ recipient
        , "Subject: " ++ subject
        , "Content-Type: text/plain"
        , ""
        ] ++ body
    return ()

Use -t flag for sendmail recipient
Use -t flag for sendmail recipient
