[ANN] gmailer-0.0.7

(Park Heesob) #1

GMailer 0.0.7 Released



This is the 0.0.7 release of GMailer.
This is a class library for interface to Google's webmail service.

What is GMailer?

GMailer can fetch mails, save attachements, get cotact lists, invite someone
or send message with file attachments. It provides edit methods for labels,
preferece settings, starring,archiving message and spam,trash managements.

What's new in this release?

Added apply_star, remove_star method for editing starring a message
Added archive, unarchive method for archiving a message
Rename get_ method e.g. get_messages -> messages, get_labels -> labels
Added mark_read, mark_unread, report_spam, not_spam method
Added trash_in, trash_out, delete_message, delete_spam, delete_trash method

How to use GMailer?
Sample usage:

GMailer.connect(name,pwd) do |g|
  g.fetch(:label=>"my_label") {|s|
        puts "Total # of conversations of my_label = " + s.box_total.to_s

  #get contact
  g.fetch(:contact=>"freq").each do |item|
    puts "Name: #{item['name']} Email: #{item['email']}"

  #send message
      :to => "whoo@foo.bar",
      :subject => "Hello There!",
      :body => "Hi...\n\nBlah blah blah~...",
      :files => ["./test.txt"]

  # update_preference
    :signature=>'This is a signature',
    :display_name=>'Display Name')

  # get preference
  pref = g.preference
  puts "Display language:#{pref['display_language']}, Max Page

  #creating new labels

  #renaming existing labels

  #deleting labels

  #applying a label to a message

  #removing a label from a message

  #apply star to a message

  #remove star from a message

  #archive a message

  #unarchive a message

  #mark a message as read

  #mark a message as unread

  #report a message as not spam

  #report a message as not spam

  #move a message to trash

  #move a message from trash to inbox

  #delete a trash message forever

  #delete a spam message forever

  #delete a message forever

  #get labels
  labels = g.labels

  #get messages
  g.messages(:label=>labels[0]).each {|m|
     puts "Subject: #{m['subject']} / Snippet: #{m['snippet']}" if m['new?']

  #get inbox messages
  g.messages(:standard=>'inbox').each {|m|
     puts "Subject: #{m['subject']} / Snippet: #{m['snippet']}" if m['new?']


Project:: http://rubyforge.org/projects/gmailutils/
Bugs:: http://rubyforge.org/tracker/?group_id=869
Document:: http://rubyforge.org/docman/?group_id=869
Download:: http://rubyforge.org/frs/?group_id=869

How do I get GMailer?

If you have RubyGems installed:

$ sudo gem install gmailer # in *NIX

gem install gmailer # in Windows

Or not, download the latest release from
and run install.rb


Park Heesob

(Shashank Date) #2

Hi Park,


  #applying a label to a message


I got an error at this line:


--- Park Heesob <phasis@bcline.com> wrote:

C:\atest>ruby tst_gmailer7.rb
my password :slight_smile:
Total # of conversations of my_label = 0
Name: shanko_date Email: shanko_date@yahoo.com
Name: shashank Email: shashank@juno.com
Display language:en, Max Page Size:50
tst_gmailer7.rb:48: undefined local variable or method `msgid' for main:Object (NameError)
        from tst_gmailer7.rb:5:in `connect'
        from tst_gmailer7.rb:5

And all I had to do was add this before that line:

   msgid = nil

It worked like a charm ... even after connecting with the proxy server.

Thanks for this great release.
-- shanko

Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around

(Daniel Schierbeck) #3

Great work!

Another idea for a change of method names: use "connected?" instead of "is_connected".

Keep up the good work!