Sal
Sal

Reputation: 4326

renderParts error in mime-mail package

I am trying to figure out how to send an email message through AWS SES using mime-mail-ses package. I used renderSendMailSES example from Yesod wiki to try the code below - I am using renderMail here to debug the error in mail body validation:

    *Main> let textPart = Part {partType = "text/plain; charset=utf-8", 
partEncoding = None, partFilename = Nothing, partHeaders = [], partContent = "Testing"}
    *Main> let htmlPart = Part { partType = "text/html; charset=utf-8", 
partEncoding = None, partFilename = Nothing, partHeaders = [], partContent = "Testing"}
    *Main> renderMail' (emptyMail $ Address Nothing "[email protected]") {
 mailTo = [Address Nothing "[email protected]"] , mailHeaders =  [ ("Subject", 
"Testing email address")], mailParts = [[textPart, htmlPart]]}

I get this error:

*** Exception: renderParts called with null parts

This is quite head-scratcher because the above example doesn't seem any different from Yesod Wiki. I can't add attachment either because of the above error. An attachment if I am not mistaken, will look like this for mailParts:

mailParts = [[textPart,htmlPart],[attachment1]]

I looked in the code that is causing the error but can't figure out what is wrong.

I will very much appreciate pointers to resolve this error.

Upvotes: 2

Views: 79

Answers (1)

Sal
Sal

Reputation: 4326

This is a versioning issue. I had a local patched copy of http-client from github (to add some streaming validation that wasn't in stackage yet) which seems to be the culprit here. I fixed it by changing the http-client to point to http-client on stackage with the release version that had my fixes (0.4.31). Now, it works fine.

Upvotes: 2

Related Questions