Hi everyone,I'm trying to use the Network.Mail.SMTP library to send email:{-# LANGUAGE OverloadedStrings #-}module Main whereimport Control.Exceptionimport qualified Data.Text as Timport qualified Data.Text.Lazy as LTimport Network.Mail.SMTPmain :: IO ()main = dosendEmail (“Person sender”, “sender@somewhere.com”)[(“Person recipient“, “recipient@somewhere.com”)]"Test email""Some message goes here."sendEmail :: (T.Text, T.Text) -> [(T.Text, T.Text)] -> T.Text -> T.Text -> IO ()sendEmail (fromName, fromEmail) toAddresses subject' body' = dolet toNameAddrs = map (\(toName, toEmail) -> Address (Just toName) toEmail) toAddressesmsg = simpleMail (Address (Just fromName) fromEmail)toNameAddrs[][]subject'[ plainTextPart $ LT.fromStrict body' ]result <- try $ sendMailWithLogin' "smtp.gmail.com"465 -- SSL port“sender_login”“sender_password”msg :: IO (Either SomeException ())case result ofLeft e -> putStrLn $ "Exception caught: " ++ (displayException e)Right _ -> putStrLn "Sent email successfully."The program compiles, but when I run it, I get:Exception caught: <socket: 49>: Data.ByteString.hGetLine: end of file
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.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe