diff options
author | Joris Guyonvarch | 2015-04-18 15:46:44 +0200 |
---|---|---|
committer | Joris Guyonvarch | 2015-04-18 15:46:44 +0200 |
commit | 86f9991deeb44a6cc81044e61a9ad3ee001c5ced (patch) | |
tree | 8c9e33635b2fea682b9c4cfb0f5fb5f2517c5563 /src/AdListener.hs | |
parent | a14b3c3d4447cbeb77e4146fba7e0d31393e625e (diff) |
Send both plain text and html in mail notifications
Diffstat (limited to 'src/AdListener.hs')
-rw-r--r-- | src/AdListener.hs | 10 |
1 files changed, 6 insertions, 4 deletions
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." |