Project

send_gmail

0.0
No commit activity in last 3 years
No release in over 3 years
incoming, outgoing mail by google gmail api
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.10
>= 0
~> 10.0
>= 0
 Project Readme

SendGmail

send_gmail handles gmail.
now it features only the acquisition of e-mail. this gem is using gmail api.
https://developers.google.com/gmail/api/

Feature

  • create draft
  • on/off label
  • other...

Installation

Add this line to your application's Gemfile:

gem 'send_gmail'

And then execute:

$ bundle

Or install it yourself as:

$ gem install send_gmail

To begin with

$ client = SendGmail::Client.new
$ client.authorize(credentials_path, client_id, client_secret, scope)

First Time

  1. browser auto open and login user
  2. auto write oauth information to credentials_path

From second time

  1. if credentials_path is exist, browser no need to open

Incoming mail

$ mail_id_list = client.mail_id_list(searching_option)
  => {
   :mail_id_list=>["ffffff", "ccccc", ...],
   :next_page_token=>"123456789"
   }

$ mail_id_list[:mail_id_list].map { |mail_id| client.mail_detail(mail_id) }
  => [#<SendGmail::Objects::Mail... , ...]
$ mail_list = client.mail_list(searching_option)
  => {
   :mail_id_list => [#<SendGmail::Objects::Mail... , ...],
   :next_page_token => "123456789"
   }

Outgoing mail

$ client.send_mail(to, subject, msg, from = nil, bcc = nil, cc = nil, user_id = 'me')
  => 200

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/hatappi/send_gmail.

License

The gem is available as open source under the terms of the MIT License.