<div dir="ltr">Alex, unfortunately I get compiler errors when adding the <i>smtp-mail-ng</i> library (I'm using Stack for my dependency management/builds). Not sure if I'm doing something wrong on my end, but it seems to be something in the library itself.<div><br></div><div><div><font face="monospace, monospace" size="1"><b>    /private/var/folders/kg/p_frph3n0d71yfmvn553s4rh0000gn/T/stack69375/smtp-mail-ng-0.1.0.2/Network/Mail/SMTP/SMTP.hs:201:3:</b></font></div><div><font face="monospace, monospace" size="1"><b>        Couldn't match type ‘Context’ with ‘IO Context’</b></font></div><div><font face="monospace, monospace" size="1"><b>        Expected type: SystemRNG -> IO Context</b></font></div><div><font face="monospace, monospace" size="1"><b>          Actual type: SystemRNG -> Context</b></font></div><div><font face="monospace, monospace" size="1"><b>        The function ‘contextNew’ is applied to three arguments,</b></font></div><div><font face="monospace, monospace" size="1"><b>        its type is ‘backend0 -> params0 -> m0 Context’,</b></font></div><div><font face="monospace, monospace" size="1"><b>        it is specialized to ‘Handle</b></font></div><div><font face="monospace, monospace" size="1"><b>                              -> ClientParams -> SystemRNG -> Context’</b></font></div><div><font face="monospace, monospace" size="1"><b>        In a stmt of a 'do' block: contextNew handle params rng</b></font></div><div><font face="monospace, monospace" size="1"><b>        In the expression:</b></font></div><div><font face="monospace, monospace" size="1"><b>          do { rng <- (createEntropyPool >>= return . cprgCreate) ::</b></font></div><div><font face="monospace, monospace" size="1"><b>                        IO SystemRNG;</b></font></div><div><font face="monospace, monospace" size="1"><b>               certStore <- getSystemCertificateStore;</b></font></div><div><font face="monospace, monospace" size="1"><b>               let params = tlsClientParams hostname certStore;</b></font></div><div><font face="monospace, monospace" size="1"><b>               contextNew handle params rng }</b></font></div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 18, 2016 at 6:15 PM, David Escobar <span dir="ltr"><<a href="mailto:davidescobar1976@gmail.com" target="_blank">davidescobar1976@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks Alex. I'll start looking into that.<div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 18, 2016 at 3:43 PM, Alexander Vieth <span dir="ltr"><<a href="mailto:aovieth@gmail.com" target="_blank">aovieth@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Right, you need to STARTTLS and upgrade to a secure connection before trying to authenticate, but smtp-mail will not take care of this for you. You could do it manually, using the tls package, or you could try
 smtp-mail-ng[1][2].<br><br></div>Alex<br><br>[1] <a href="https://github.com/avieth/smtp-mail-ng" target="_blank">https://github.com/avieth/smtp-mail-ng</a><br>[2] <a href="https://hackage.haskell.org/package/smtp-mail-ng-0.1.0.1" target="_blank">https://hackage.haskell.org/package/smtp-mail-ng-0.1.0.1</a></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 18, 2016 at 6:36 PM, David Escobar <span dir="ltr"><<a href="mailto:davidescobar1976@gmail.com" target="_blank">davidescobar1976@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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><div><div><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></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div><div><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 color="#351c75" face="monospace, monospace" size="1"><b>{-# LANGUAGE OverloadedStrings #-}</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b><br></b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>module Main where</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b><br></b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>import Control.Exception</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b><br></b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>import qualified Data.Text as T</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>import qualified Data.Text.Lazy as LT</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>import Network.Mail.SMTP</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b><br></b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>main :: IO ()</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>main = do</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>  sendEmail (“Person sender”, “<a href="mailto:sender@somewhere.com" target="_blank">sender@somewhere.com</a>”)</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>            [(“Person recipient“, “<a href="mailto:recipient@somewhere.com" target="_blank">recipient@somewhere.com</a>”)]</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>            "Test email"</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>            "Some message goes here."</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b><br></b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b><br></b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>sendEmail :: (T.Text, T.Text) -> [(T.Text, T.Text)] -> T.Text -> T.Text -> IO ()</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>sendEmail (fromName, fromEmail) toAddresses subject' body' = do</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>  let toNameAddrs = map (\(toName, toEmail) -> Address (Just toName) toEmail) toAddresses</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>      msg = simpleMail (Address (Just fromName) fromEmail)</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>                       toNameAddrs</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>                       []</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>                       []</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>                       subject'</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>                       [ plainTextPart $ LT.fromStrict body' ]</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>  result <- try $ sendMailWithLogin' "<a href="http://smtp.gmail.com" target="_blank">smtp.gmail.com</a>"</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>                                     465 -- SSL port</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>                                     “sender_login”</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>                                     “sender_password”</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>                                     msg :: IO (Either SomeException ())</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>  case result of</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>    Left e -> putStrLn $ "Exception caught: " ++ (displayException e)</b></font></div><div><font color="#351c75" face="monospace, monospace" size="1"><b>    Right _ -> putStrLn "Sent email successfully."</b></font></div></div><div><font color="#351c75" face="monospace, monospace" size="1"><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></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><font color="#888888"><span><font color="#888888"><br>
</font></span></font></span></blockquote></div><span><font color="#888888"><span><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></font></span></blockquote></div><br></div>
<br>_______________________________________________<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><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>