简体   繁体   中英

How do I let users send and receive email using Gmail in Ruby on Rails?

For my application I have users that I would like to be able to send and receive emails inside of the application itself. I am wanting to integrate Gmail for this purpose because I already have OAuth2 authentication integrated.

I have gone through the process of creating the Google App, getting the correct credentials, setting up OAuth2, getting their token etc.

Unfortunately, I can't figure out how to talk to the Gmail API and use it in order to be able to send and receive emails using it for specific users within the application.

I have found several gems such as gmail_xoauth and gmail-ruby-api which look as though I may have to implement them first, but I am not sure how or what to do in orde r to do so.

I am new to rails and a bit confused, so thanks for your help.

Here is a nice tutorial explaining this using the Gmail gem and omniauth-google-oauth2 gem.

With Gmail gem users can Search, read and send multipart emails, archive, mark as read/unread, delete emails, and manage labels.

This gem has so many handy methods like the one following

gmail.inbox.emails(:unread, :before => Date.parse("2010-04-20"), :from => "myboss@gmail.com")

documentation is pretty decent with examples for sending, receiving and processing attachments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM