@@ -20,6 +20,7 @@ module Network.API.Mandrill (
20 -- $exampleusage
20 -- $exampleusage
23import Control.Monad.Reader
24import Control.Monad.Reader
24import qualified Data.Aeson as JSON
25import qualified Data.Aeson as JSON
25import qualified Data.HashMap.Strict as H
26import qualified Data.HashMap.Strict as H
@@ -106,7 +107,7 @@ newHtmlMessage :: EmailAddress
106 -- ^ The HTML body
107 -- ^ The HTML body
107 -> MandrillMessage
108 -> MandrillMessage
108newHtmlMessage f t subj html = let body = mkMandrillHtml html in
109newHtmlMessage f t subj html = let body = mkMandrillHtml html in
109− (emptyMessage f t) { _mmsg_html = body, _mmsg_subject = subj }
110+ ((mmsg_html .~ body) . (mmsg_subject .~ subj)) $ (emptyMessage f t)
111--------------------------------------------------------------------------------
112--------------------------------------------------------------------------------
112-- | Create a new template message (no HTML).
113-- | Create a new template message (no HTML).
@@ -117,7 +118,7 @@ newTemplateMessage :: EmailAddress
117 -> T.Text
118 -> T.Text
118 -- ^ Subject
119 -- ^ Subject
119 -> MandrillMessage
120 -> MandrillMessage
120−newTemplateMessage f t subj = (emptyMessage f t) { _mmsg_subject = subj }
121+newTemplateMessage f t subj = (mmsg_subject .~ subj) $ (emptyMessage f t)
122--------------------------------------------------------------------------------
123--------------------------------------------------------------------------------
123-- | Create a new textual message. By default Mandrill doesn't require you
124-- | Create a new textual message. By default Mandrill doesn't require you
@@ -133,11 +134,9 @@ newTextMessage :: EmailAddress
133 -- ^ The body, as normal text.
134 -- ^ The body, as normal text.
134 -> MandrillMessage
135 -> MandrillMessage
135newTextMessage f t subj txt = let body = unsafeMkMandrillHtml txt in
136newTextMessage f t subj txt = let body = unsafeMkMandrillHtml txt in
136− (emptyMessage f t) {
137+ ((mmsg_html .~ body) .
138− , _mmsg_text = Just txt
138+ (mmsg_text .~ Just txt) .
139− , _mmsg_subject = subj
139+ (mmsg_subject .~ subj)) (emptyMessage f t)
143--------------------------------------------------------------------------------
142--------------------------------------------------------------------------------