jtdaugherty/HaskellNet — Issue #3: Old bug report
Author: jtdaugherty
Created: 2011-12-27 17:02:51+00:00
State: open

From Dmitry Olshansky olshanskydr@gmail.com:

I send mail using package HaskellNet(doSMTP, sendMimeMail) in this way:

> doSMTP smtpServer $ sendMimeMail to from subj mempty (LT.pack $ mess) []

For SMTP HaskellNet use mime-mail package with QuotablePrintable format. But sometimes additional symbols '=' are appearing there. If I change format to Base64 all is correct.

Michael Snoyman found that:

> HaskellNet. In Network.HaskellNet.SMTP, the line
>
> mapM_ sendLine $ BS.lines dat ++ [BS.pack "."]
>
> combined with
>
> where sendLine l = bsPutCrLf conn l
>
> most likely adds an additional CR in the stream. I think the correct
> code should either send the data verbatim or, if you really want to
> break it up into lines and ensure CRLF for every line ending, you need
> to strip trailing CRs from after the cal to BS.lines (I ran into this
> exact bug once). Basically:
>
> bsLines = map stripCR . BS.lines
> stripCR x = if not (BS.null x) && BS.last x == 13 then BS.init x else x

Could you check and correct that?