haskell - mime-mail 包中的 renderParts 错误

标签 haskell yesod

我正在尝试弄清楚如何使用 mime-mail-ses 通过 AWS SES 发送电子邮件。包裹。我使用了 Yesod wiki 中的 renderSendMailSES 示例尝试下面的代码 - 我在这里使用 renderMail 来调试 mail 正文验证中的错误:

    *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 "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b3dddcc1d6c3dfcaf3d6cbd2dec3dfd69dd0dcde" rel="noreferrer noopener nofollow">[email protected]</a>") {
 mailTo = [Address Nothing "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="780c1d0b0c381d00191508141d561b1715" rel="noreferrer noopener nofollow">[email protected]</a>"] , mailHeaders =  [ ("Subject", 
"Testing email address")], mailParts = [[textPart, htmlPart]]}

我收到此错误:

*** Exception: renderParts called with null parts

这相当令人头疼,因为上面的例子看起来与 Yesod Wiki 没有任何不同。由于上述错误,我也无法添加附件。如果我没记错的话,mailParts 的附件将如下所示:

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

我查看了导致错误的代码,但无法找出问题所在。

我将非常感谢解决此错误的指示。

最佳答案

这是一个版本控制问题。我有一个来自 github 的 http-client 本地修补副本(以添加一些 stackage 中尚未包含的流验证),这似乎是罪魁祸首。我通过将 http-client 更改为指向堆栈上的 http-client 以及已修复的发行版本 (0.4.31) 来修复此问题。现在,一切正常。

关于haskell - mime-mail 包中的 renderParts 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38855360/

相关文章:

haskell - Yesod路由解析说明

haskell - 使用 jqueryDayField 作为 UTCTime

haskell - Control.Applicative 中 `pure` 函数的命名

haskell - Project Euler 15 - 最后一次尝试

haskell - Cabal Mac OS(雪豹)出错 - ld : unknown option: -no_pie

haskell - 如何通过 IO 操作在某些非 IO monad 中惯用且有效地使用 Pipe?

haskell - 如何使用 Yesod 的 Persistent 创建带有子数组的 MongoDB 文档?

haskell - 如何捕获httpLbs(http-client)抛出的异常

haskell - 开始使用 Yesod

postgresql - Yesod persistent-postgresql rawSql 查询与列列表通配符产生语法错误