Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {-# LANGUAGE OverloadedStrings #-}
- import Network.HaskellNet.IMAP.SSL
- import Network.HaskellNet.SMTP.SSL as SMTP
- import Network.HaskellNet.Auth (AuthType(LOGIN))
- import qualified Data.ByteString.Char8 as B
- username = "test.mailer@gmail.com"
- password = "<password>"
- recipient = "recipent@mail.com"
- smtpTest = doSMTPSTARTTLS "smtp.gmail.com" $ \c -> do
- authSucceed <- SMTP.authenticate LOGIN username password c
- if authSucceed
- then sendPlainTextMail recipient username subject body c
- else print "Authentication error."
- where subject = "Test message"
- body = "This is a test message"
- main :: IO ()
- main = do
- smtpTest
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement