Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prelude.read: no parse exception when trying to send an email #36

Open
kibebr opened this issue Aug 1, 2022 · 1 comment
Open

Prelude.read: no parse exception when trying to send an email #36

kibebr opened this issue Aug 1, 2022 · 1 comment

Comments

@kibebr
Copy link

kibebr commented Aug 1, 2022

Hey,

I have been trying to send an email with the following code:

{-# LANGUAGE OverloadedStrings #-}

module Main where

import qualified MyLib (someFunc)
import qualified Data.Text as T
import qualified Data.Text.Lazy as TL
import Network.Mail.SMTP

from       = Address Nothing "[email protected]"
to         = [Address (Just "Jason Hickner") "[email protected]"]
cc         = []
bcc        = []
subject    = "email subject"
body       = plainTextPart "email body"
html       = htmlPart "<h1>HTML</h1>"

mail = simpleMail from to cc bcc subject [body, html]

main :: IO ()
main = do 
  sendMailWithLogin' "smtp.gmail.com" 465 "username" "pwd" mail

However, I am getting

tesths: Prelude.read: no parse

Any pointers to why this must be happening?

Thanks

The cabal.sbt is just simply:

cabal-version:      2.4
name:               tesths
version:            0.1.0.0

-- A short (one-line) description of the package.
-- synopsis:

-- A longer description of the package.
-- description:

-- A URL where users can report bugs.
-- bug-reports:

-- The license under which the package is released.
-- license:

-- The package author(s).
-- author:

-- An email address to which users can send suggestions, bug reports, and patches.
-- maintainer:

-- A copyright notice.
-- copyright:
-- category:
extra-source-files: CHANGELOG.md

library
    exposed-modules:  MyLib

    -- Modules included in this library but not exported.
    -- other-modules:

    -- LANGUAGE extensions used by modules in this package.
    -- other-extensions:
    build-depends:    base ^>=4.16.1.0, text, mime-mail, smtp-mail
    hs-source-dirs:   src
    default-language: Haskell2010

executable tesths
    main-is:          Main.hs

    -- Modules included in this executable, other than Main.
    -- other-modules:

    -- LANGUAGE extensions used by modules in this package.
    -- other-extensions:
    build-depends:
        base ^>=4.16.1.0,
        tesths,
        text,
        mime-mail,
        smtp-mail

    hs-source-dirs:   app
    default-language: Haskell2010
@xieyuschen
Copy link

@kibebr Try sendMailWithLoginTLS, which has a default port. It could work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants