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

Add TLS support #2

Closed
joeyadams opened this issue Dec 15, 2012 · 4 comments
Closed

Add TLS support #2

joeyadams opened this issue Dec 15, 2012 · 4 comments

Comments

@joeyadams
Copy link
Contributor

I'm just creating this ticket to prevent duplicated work. I'm working on TLS support right now.

First, I'm going to make a pure interface to the SMTP functionality by using a beautiful dependency injection technique:

class Monad m => MonadSMTP m where
    putCrLf :: ByteString -> m ()
    throwSMTPError :: SMTPError -> m a

The protocol functions (sendCommand, etc.) will be in the MonadSMTP class:

sendCommand :: MonadSMTP m => Command -> m (ReplyCode, ByteString)

And the caller will provide a MonadSMTP instance that provides all of the requested capabilities.

This has several benefits:

  • Isolates the pure code from side effects, simplifying reasoning
  • Lets us operate on both a Handle and a TLS [Context](we need to do both to support TLS)
  • Keeps subroutines from having to pass the SMTPConnection down the call chain. A Reader monad would provide the same benefit.
  • Provides sufficient flexibility to implement, say, an smtp-conduit package
@jhickner
Copy link
Owner

This sounds great! I'll be looking forward to your pull request.

@alevy
Copy link

alevy commented Mar 26, 2014

I'm assuming this never happened?

@shoooe
Copy link

shoooe commented Feb 17, 2015

@alevy Apparently not.

@jhickner
Copy link
Owner

This fork has has seen a lot more development progress. Check it out, it may have what you're looking for: https://github.com/avieth/smtp-mail

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

4 participants