Skip to content

Get access to IMAP and STMP via OAuth2, using the standard Ruby Net libraries

License

Notifications You must be signed in to change notification settings

Mailbutler/mail_xoauth2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1a5ad71 · Feb 20, 2024

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mail_xoauth2 Gem Version

Get access to IMAP and STMP via OAuth2, using the standard Ruby Net libraries.

This gem is based on and inspired by gmail_xoauth.

Install

$ gem install mail_xoauth2

Usage

IMAP OAuth 2.0

require 'mail_xoauth2'
imap = Net::IMAP.new('imap.gmail.com', 993, usessl = true, certs = nil, verify = false)
imap.authenticate('XOAUTH2', '[email protected]', my_oauth2_token)
messages_count = imap.status('INBOX', ['MESSAGES'])['MESSAGES']
puts "Seeing #{messages_count} messages in INBOX"

SMTP OAuth 2.0

require 'mail_xoauth2'
smtp = Net::SMTP.new('smtp.gmail.com', 587)
smtp.enable_starttls_auto
smtp.start('gmail.com', '[email protected]', my_oauth2_token, :xoauth2)
smtp.finish

License

See LICENSE for details.

About

Get access to IMAP and STMP via OAuth2, using the standard Ruby Net libraries

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages