Haskell: SMTP over SSL

I wanted to write a script utility in Haskell last night that sent some emails using my gmail account.

However, gmail requires an SSL / TLS connection to their SMTP server , and I could not figure out how to do this using HaskellNet sendMail .

How could I do this using HaskellNet? Or is there another SMTP library I should use?

+6
source share
3 answers

This is a pretty old post now, but I just thought that I would drink the answer in case someone stumbles upon it, looking for SSL / TLS support for IMAP / SMTP. I put the library in Hackage, which adds TLS support for HaskellNet email functionality, doing pretty much what the hammar suggested in his answer .

You can find the library here: http://hackage.haskell.org/package/HaskellNet-SSL along with sample code here .

+6
source

With a quick look at the documents, I noticed connectStream , which allows you to use an already open stream, as well as the fact that all functions work on BSStream s => s , and not in a simple Handle . I assume that you can use this with the tls package to record a BSStream instance for TLSCtx a (or a new type) to allow you to use a TLS / SSL connection with HaskellNet sendMail .

I have no experience with any package, but it seems that this is possible.

+2
source

Have you considered setting up sendmail with GMail and using smtp-mail to talk to sendmail ?

+1
source

Source: https://habr.com/ru/post/900932/


All Articles