From 86f9991deeb44a6cc81044e61a9ad3ee001c5ced Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Sat, 18 Apr 2015 15:46:44 +0200 Subject: Send both plain text and html in mail notifications --- src/AdListener.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/AdListener.hs') diff --git a/src/AdListener.hs b/src/AdListener.hs index c08efc5..4fc9b20 100644 --- a/src/AdListener.hs +++ b/src/AdListener.hs @@ -17,7 +17,8 @@ import Model.Ad import Model.URL import Model.Resume -import View.Ad +import qualified View.Plain.Ad as P +import qualified View.Html.Ad as H import Page import Parser.Detail @@ -64,7 +65,7 @@ listenToNewAdsWithResumes config viewedURLs resumes = time <- getCurrentFormattedTime if not (null newAds) then - let message = renderConsoleAds time newAds + let message = P.renderConsoleAds time newAds in do T.putStrLn message trySendMail config newAds @@ -79,9 +80,10 @@ trySendMail config ads = Nothing -> return () Just mailTo -> - let (title, message) = renderAds ads + let (title, plainBody) = P.renderAds ads + htmlBody = H.renderAds ads in do - eitherMailSuccess <- sendMail mailTo title message + eitherMailSuccess <- sendMail mailTo title plainBody htmlBody case eitherMailSuccess of Right () -> putStrLn "\nMail sent." -- cgit v1.2.3