From 778040bf9f3f60ec50b1b437f93ab123854917f2 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 26 Mar 2017 21:11:02 +0200 Subject: Copy mime-mail locally The path is wrong, it is configurable with --ghc-options but I can't get it right for now with stack. --- src/server/SendMail.hs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/server/SendMail.hs') diff --git a/src/server/SendMail.hs b/src/server/SendMail.hs index e434b38..f7ba3fd 100644 --- a/src/server/SendMail.hs +++ b/src/server/SendMail.hs @@ -4,25 +4,24 @@ module SendMail ( sendMail ) where +import Control.Arrow (left) +import Control.Exception (SomeException, try) +import Data.Either (isLeft) + import Data.Text (Text) +import Data.Text.Lazy.Builder (toLazyText, fromText) import qualified Data.Text as T -import Data.Either (isLeft) import qualified Data.Text.Lazy as LT -import Data.Text.Lazy.Builder (toLazyText, fromText) - -import Control.Exception (SomeException, try) -import Control.Arrow (left) - -import qualified Network.Mail.Mime as M +import qualified MimeMail as M -import Model.Mail +import Model.Mail (Mail(Mail)) sendMail :: Mail -> IO (Either Text ()) sendMail mail = do result <- left (T.pack . show) <$> (try (M.renderSendMail . getMimeMail $ mail) :: IO (Either SomeException ())) if isLeft result - then putStrLn ("Error sending the following email:" ++ (show mail)) - else return () + then putStrLn ("Error sending the following email:" ++ (show mail) ++ "\n" ++ (show result)) + else putStrLn "OK" return result getMimeMail :: Mail -> M.Mail -- cgit v1.2.3