<div dir="ltr">No explicit mention is made anywhere in the documentation about TLS or even SSL, so perhaps not? Some libraries I've come across specifically mention that they don't support TLS or SSL. Being relatively new to this part of Haskell, what is the most standard library the community uses for email that supports modern protocols such as those used by GMail? Thanks.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 18, 2016 at 2:49 PM, Alex Feldman-Crough <span dir="ltr"><<a href="mailto:alex@fldcr.com" target="_blank">alex@fldcr.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Does the library support TLS? Does it have to be configured differently? It sounds like a negotiation error to me. <br><div class="gmail_quote"><div><div class="h5"><div dir="ltr">On Mon, Apr 18, 2016 at 2:43 PM David Escobar <<a href="mailto:davidescobar1976@gmail.com" target="_blank">davidescobar1976@gmail.com</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi everyone,<div>I'm trying to use the <i>Network.Mail.SMTP</i> library to send email:</div><div><br></div><div><div><font face="monospace, monospace" size="1" color="#351c75"><b>{-# LANGUAGE OverloadedStrings #-}</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b><br></b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>module Main where</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b><br></b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>import Control.Exception</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b><br></b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>import qualified Data.Text as T</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>import qualified Data.Text.Lazy as LT</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>import Network.Mail.SMTP</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b><br></b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>main :: IO ()</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>main = do</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>  sendEmail (“Person sender”, “<a href="mailto:sender@somewhere.com" target="_blank">sender@somewhere.com</a>”)</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>            [(“Person recipient“, “<a href="mailto:recipient@somewhere.com" target="_blank">recipient@somewhere.com</a>”)]</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>            "Test email"</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>            "Some message goes here."</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b><br></b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b><br></b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>sendEmail :: (T.Text, T.Text) -> [(T.Text, T.Text)] -> T.Text -> T.Text -> IO ()</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>sendEmail (fromName, fromEmail) toAddresses subject' body' = do</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>  let toNameAddrs = map (\(toName, toEmail) -> Address (Just toName) toEmail) toAddresses</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>      msg = simpleMail (Address (Just fromName) fromEmail)</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>                       toNameAddrs</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>                       []</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>                       []</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>                       subject'</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>                       [ plainTextPart $ LT.fromStrict body' ]</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>  result <- try $ sendMailWithLogin' "<a href="http://smtp.gmail.com" target="_blank">smtp.gmail.com</a>"</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>                                     465 -- SSL port</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>                                     “sender_login”</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>                                     “sender_password”</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>                                     msg :: IO (Either SomeException ())</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>  case result of</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>    Left e -> putStrLn $ "Exception caught: " ++ (displayException e)</b></font></div><div><font face="monospace, monospace" size="1" color="#351c75"><b>    Right _ -> putStrLn "Sent email successfully."</b></font></div></div><div><font face="monospace, monospace" size="1" color="#351c75"><b><br></b></font></div><div><br></div><div>The program compiles, but when I run it, I get:</div><div>







<p><span><font face="monospace, monospace"><b>Exception caught: <socket: 49>: Data.ByteString.hGetLine: end of file</b></font></span></p><p><span>I tried using the TLS port of 587, but then I just get an authentication failure. Am I using the wrong library or is it just the wrong configuration. Thanks.</span></p></div></div></div></div>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><span class="HOEnZb"><font color="#888888"><br>
</font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><div dir="ltr">-- <br></div>Alex Feldman Crough<br><a href="tel:602%20573-9588" value="+16025739588" target="_blank">602 573-9588</a>
</font></span></blockquote></div><br></div>