Advertisement
Guest User

Untitled

a guest
Apr 14th, 2017
543
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. {-# LANGUAGE OverloadedStrings #-}
  2.  
  3. import Network.HaskellNet.IMAP.SSL
  4. import Network.HaskellNet.SMTP.SSL as SMTP
  5.  
  6. import Network.HaskellNet.Auth (AuthType(LOGIN))
  7.  
  8. import qualified Data.ByteString.Char8 as B
  9.  
  10. username = "test.mailer@gmail.com"
  11. password = "<password>"
  12. recipient = "recipent@mail.com"
  13.  
  14. smtpTest = doSMTPSTARTTLS "smtp.gmail.com" $ \c -> do
  15. authSucceed <- SMTP.authenticate LOGIN username password c
  16. if authSucceed
  17. then sendPlainTextMail recipient username subject body c
  18. else print "Authentication error."
  19. where subject = "Test message"
  20. body = "This is a test message"
  21.  
  22. main :: IO ()
  23. main = do
  24. smtpTest
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement