GMailer is a class for interface to Google's webmail service.

It can fetch mails, save attachements, get cotact lists, invite someone
or send message with file attachments.

CHANGE since 0.0.4
- add create_label, delete_label, rename_label, apply_label, delete_label 
method
- add update_preference, get_preference method
- fix some bugs

The usage is very simple and compact like this:

GMailer.connect(name,pwd) do |g|
  #fetch
  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']}"
  end

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

  # update_preference
  g.update_preference(:max_page_size=>50,
    :keyboard_shortcuts=>true,
    :indicators=>true,
    :display_language=>'en',
    :signature=>'This is a signature',
    :reply_to=>'return / foo.bar',
    :snippets=>true,
    :display_name=>'Display Name')

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

  #creating new labels
  g.create_label('label_name')

  #renaming existing labels
  g.rename_label('label_name','renamed_label')

  #deleting labels
  g.delete_label('label_name')

  #applying a label to a message
  g.apply_label(msgid,'label_name')

  #removing a label from a message
  g.remove_label(msgid,'label_name')

  # get labels
  labels = g.get_labels

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


Project:: http://rubyforge.org/projects/gmailutils/
Bugs:: http://rubyforge.org/tracker/?group_id=869


Regards,

Park Heesob