jhickner / smtp-mail

Making it easy to send SMTP email from Haskell
BSD 3-Clause "New" or "Revised" License
75 stars 32 forks source link

Support for OAuth authentication #34

Open robstewart57 opened 2 years ago

robstewart57 commented 2 years ago

This library supports PLAIN, LOGIN and CRAM_MD5 authentication mechanisms.

This issue is a feature request for OAuth2 based authentication for sending emails with this library, with a XOAUTH2 constructor for AuthType and supporting functions in Network/Mail/SMTP.hs.

Such that the SMTP client transmits this to the SMTP server:

AUTH XOAUTH2 <oauth token>

rather than providing a username and password as with LOGIN. Instead, a username and OAuth token would be provided.

It might be that this library would need to encode this information in SASL XOAUTH2 format.

typetetris commented 2 years ago

I don't have access to Office365 nor any mail server using SASL XOAUTH2.

How could I test this against a real server after implementation? Are there freely available mail services providing this OAuth2 authentication?

robstewart57 commented 1 year ago

Hi @typetetris ,

I've opened a pull request that implements OAuth authentication for this library.

PR: https://github.com/jhickner/smtp-mail/pull/38