0.01
Low commit activity in last 3 years
A long-lived project that still receives updates
Get access to IMAP and STMP via OAuth2, using the standard Ruby Net libraries
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
 Project Readme

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', 'myemail@gmail.com', 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', 'myemail@gmail.com', my_oauth2_token, :xoauth2)
smtp.finish

License

See LICENSE for details.