# \[ANN\] gmailer-0.0.8 released

**URL:** https://rubytalk.org/t/ann-gmailer-0-0-8-released/20587
**Category:** ruby-talk
**Created:** [3 September 2005 10:05 UTC](https://rubytalk.org/t/ann-gmailer-0-0-8-released/20587 "2005-09-03T10:05:18Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Park\_Heesob3](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@Park\_Heesob3](https://rubytalk.org/u/Park_Heesob3)
#### Post date: [3 September 2005 10:05 UTC](https://rubytalk.org/t/ann-gmailer-0-0-8-released/20587/1 "2005-09-03T10:05:18Z")

</div>

GMailer 0.0.8 Released

> **···**
>
> =======================
> 
> This is the 0.0.8 release of GMailer by Park Heesob.  
> 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 and archiving message.
> 
> What's new in this release?  
> ---------------------------
> 
> Rename is\_connected method to connected?  
> Add support for the new feature 'Send mail as'. If you have multiple  
> verified  
> "Send mail as:" email addresses, you can choose one 'From:' email address.  
> Refer to [http://gmail.google.com/support/bin/answer.py?answer=20616](http://gmail.google.com/support/bin/answer.py?answer=20616)  
> Thanks Daniel Schierbeck and Michel Martens!
> 
> How to use GMailer?  
> -----------------------  
> Sample usage:
> 
> GMailer.connect(name,pwd) do |g|  
> &nbsp;&nbsp;#fetch  
> &nbsp;&nbsp;g.fetch(:label=\>"my\_label") {|s|  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "Total # of conversations of my\_label = " + s.box\_total.to\_s  
> &nbsp;&nbsp;}
> 
> &nbsp;&nbsp;#get contact  
> &nbsp;&nbsp;g.fetch(:contact=\>"freq").each do |item|  
> &nbsp;&nbsp;&nbsp;&nbsp;puts "Name: #{item['name']} Email: #{item['email']}"  
> &nbsp;&nbsp;end
> 
> &nbsp;&nbsp;#send message  
> &nbsp;&nbsp;# 'From' default gmail.com account  
> &nbsp;&nbsp;g.send(  
> &nbsp;&nbsp;&nbsp;&nbsp;:to =\> "who@what.com, my\_friend@his\_company.com, god@heaven.org"  
> &nbsp;&nbsp;&nbsp;&nbsp;:cc =\> "foo@bar.com"  
> &nbsp;&nbsp;&nbsp;&nbsp;:subject =\> "Hello There!",  
> &nbsp;&nbsp;&nbsp;&nbsp;:body =\> "Hi...\n\nBlah blah blah~~...",  
> &nbsp;&nbsp;&nbsp;&nbsp;:files =\> ["./my\_pic.jpg", "./my\_cv.txt"])
> 
> &nbsp;&nbsp;# multiple verified email addresses and choose one 'From:' email address  
> &nbsp;&nbsp;g.send(  
> &nbsp;&nbsp;&nbsp;&nbsp;:from =\> "verified@email.com",  
> &nbsp;&nbsp;&nbsp;&nbsp;:to =\> "who@what.com, my\_friend@his\_company.com, god@heaven.org"  
> &nbsp;&nbsp;&nbsp;&nbsp;:cc =\> "foo@bar.com"  
> &nbsp;&nbsp;&nbsp;&nbsp;:subject =\> "Hello There!",  
> &nbsp;&nbsp;&nbsp;&nbsp;:body =\> "Hi...\n\nBlah blah blah~~...",  
> &nbsp;&nbsp;&nbsp;&nbsp;:files =\> ["./my\_pic.jpg", "./my\_cv.txt"])
> 
> &nbsp;&nbsp;# update\_preference  
> &nbsp;&nbsp;g.update\_preference(:max\_page\_size=\>50,  
> &nbsp;&nbsp;&nbsp;&nbsp;:keyboard\_shortcuts=\>true,  
> &nbsp;&nbsp;&nbsp;&nbsp;:indicators=\>true,  
> &nbsp;&nbsp;&nbsp;&nbsp;:display\_language=\>'en',  
> &nbsp;&nbsp;&nbsp;&nbsp;:signature=\>'This is a signature',  
> &nbsp;&nbsp;&nbsp;&nbsp;:reply\_to=\>'return@foo.bar',  
> &nbsp;&nbsp;&nbsp;&nbsp;:snippets=\>true,  
> &nbsp;&nbsp;&nbsp;&nbsp;:display\_name=\>'Display Name')
> 
> &nbsp;&nbsp;# get preference  
> &nbsp;&nbsp;pref = g.preference  
> &nbsp;&nbsp;puts "Display language:#{pref['display\_language']}, Max Page  
> Size:#{pref['max\_page\_size']}"
> 
> &nbsp;&nbsp;#creating new labels  
> &nbsp;&nbsp;g.create\_label('label\_name')
> 
> &nbsp;&nbsp;#renaming existing labels  
> &nbsp;&nbsp;g.rename\_label('label\_name','renamed\_label')
> 
> &nbsp;&nbsp;#deleting labels  
> &nbsp;&nbsp;g.delete\_label('label\_name')
> 
> &nbsp;&nbsp;#applying a label to a message  
> &nbsp;&nbsp;g.apply\_label(msgid,'label\_name')
> 
> &nbsp;&nbsp;#removing a label from a message  
> &nbsp;&nbsp;g.remove\_label(msgid,'label\_name')
> 
> &nbsp;&nbsp;#apply star to a message  
> &nbsp;&nbsp;g.apply\_star(msgid)
> 
> &nbsp;&nbsp;#remove star from a message  
> &nbsp;&nbsp;g.remove\_star(msgid)
> 
> &nbsp;&nbsp;#archive a message  
> &nbsp;&nbsp;g.archive(msgid)
> 
> &nbsp;&nbsp;#unarchive a message  
> &nbsp;&nbsp;g.unarchive(msgid)
> 
> &nbsp;&nbsp;#mark a message as read  
> &nbsp;&nbsp;g.mark\_read(msgid)
> 
> &nbsp;&nbsp;#mark a message as unread  
> &nbsp;&nbsp;g.mark\_unread(msgid)
> 
> &nbsp;&nbsp;#report a message as not spam  
> &nbsp;&nbsp;g.report\_spam(msgid)
> 
> &nbsp;&nbsp;#report a message as not spam  
> &nbsp;&nbsp;g.not\_spam(msgid)
> 
> &nbsp;&nbsp;#move a message to trash  
> &nbsp;&nbsp;g.trash\_in(msgid)
> 
> &nbsp;&nbsp;#move a message from trash to inbox  
> &nbsp;&nbsp;g.trash\_out(msgid)
> 
> &nbsp;&nbsp;#delete a trash message forever  
> &nbsp;&nbsp;g.delete\_trash(msgid)
> 
> &nbsp;&nbsp;#delete a spam message forever  
> &nbsp;&nbsp;g.delete\_spam(msgid)
> 
> &nbsp;&nbsp;#get labels  
> &nbsp;&nbsp;labels = g.labels
> 
> &nbsp;&nbsp;#get messages  
> &nbsp;&nbsp;g.messages(:label=\>labels[0]).each {|m|  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "Subject: #{m['subject']} / Snippet: #{m['snippet']}" if m['new?']  
> &nbsp;&nbsp;}
> 
> &nbsp;&nbsp;#get inbox messages  
> &nbsp;&nbsp;g.messages(:standard=\>'inbox').each {|m|  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "Subject: #{m['subject']} / Snippet: #{m['snippet']}" if m['new?']  
> &nbsp;&nbsp;}
> 
> end
> 
> Project:: [http://rubyforge.org/projects/gmailutils/](http://rubyforge.org/projects/gmailutils/)  
> Bugs:: [http://rubyforge.org/tracker/?group\_id=869](http://rubyforge.org/tracker/?group_id=869)  
> Document:: [http://rubyforge.org/docman/?group\_id=869](http://rubyforge.org/docman/?group_id=869)  
> Download:: [http://rubyforge.org/frs/?group\_id=869](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  
> [http://rubyforge.org/frs/?group\_id=869](http://rubyforge.org/frs/?group_id=869)  
> and run install.rb
> 
> Cheers,
> 
> Park Heesob

---

<div class="post-metadata">

### Author: ![Daniel\_Schierbeck](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daniel\_Schierbeck](https://rubytalk.org/u/Daniel_Schierbeck)
#### Post date: [3 September 2005 15:16 UTC](https://rubytalk.org/t/ann-gmailer-0-0-8-released/20587/2 "2005-09-03T15:16:26Z")

</div>

Sweeeeeeeeet!

Cheers,  
Daniel

---

<div class="post-metadata">

### Author: ![Daniel\_Schierbeck](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daniel\_Schierbeck](https://rubytalk.org/u/Daniel_Schierbeck)
#### Post date: [3 September 2005 17:26 UTC](https://rubytalk.org/t/ann-gmailer-0-0-8-released/20587/3 "2005-09-03T17:26:26Z")

</div>

One thing that would be cool is a more advanced API. Something along the lines of this:

Module GMailer  
&nbsp;&nbsp;&nbsp;# the main class.  
&nbsp;&nbsp;&nbsp;class Connection  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# returns the messages that match the filters  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# or all messages if no filter is provided  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def messages (filters = {}); end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# returns all labels  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def labels; end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# returns the label that has the name "name"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# as a Label object  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def label (name); end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# etc etc  
&nbsp;&nbsp;&nbsp;end

&nbsp;&nbsp;&nbsp;# a list of messages. should be sortable and searchable.  
&nbsp;&nbsp;&nbsp;class MessageList; end

&nbsp;&nbsp;&nbsp;# a single message  
&nbsp;&nbsp;&nbsp;class Message  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;attr\_reader :subject, :body, :to, :from, :date

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# applies a label to the message.  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# can take either a string or a Label object as argument  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def apply\_label (label); end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def remove\_label; end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def archive; end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def unarchive; end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def archived?; end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def mark\_read; end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def mark\_unread; end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def read?; end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def report\_spam; end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def report\_not\_spam; end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def spam?; end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def trash; end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def untrash; end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# etc etc  
&nbsp;&nbsp;&nbsp;end

&nbsp;&nbsp;&nbsp;class Label  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# you get the picture  
&nbsp;&nbsp;&nbsp;end

&nbsp;&nbsp;&nbsp;def connect (\*args, &block)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Connection.new(\*args, &block)  
&nbsp;&nbsp;&nbsp;end  
end

GMailer::connect(username, password) do |gmail|  
&nbsp;&nbsp;&nbsp;gmail.messages(:unread).each do |msg|  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "subject: " + msg.subject  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "from: " + msg.from  
&nbsp;&nbsp;&nbsp;end  
end

---

<div class="post-metadata">

### Author: ![David\_Teare](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@David\_Teare](https://rubytalk.org/u/David_Teare)
#### Post date: [3 September 2005 17:32 UTC](https://rubytalk.org/t/ann-gmailer-0-0-8-released/20587/4 "2005-09-03T17:32:31Z")

</div>

Thanks for sharing this as a GEM.

I am having some troubles getting it to work. I installed gmailer v0.8 but I can't figure out how to "require" it. Am I missing something obvious?

$ gem list | grep gmail  
gmailer (0.0.8)  
$ ruby --version  
ruby 1.8.2 (2004-12-25) [powerpc-darwin7.8.0]  
$ gem --version  
0.8.10

$ irb  
irb(main):001:0\> require "GMail"  
LoadError: No such file to load -- GMail  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):1:in `require'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):1  
irb(main):002:0\> require "GMailer"  
LoadError: No such file to load -- GMailer  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):2:in `require'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):2  
irb(main):003:0\> require "gmailer"  
LoadError: No such file to load -- gmailer  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):3:in `require'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):3

> **···**
>
> On 3-Sep-05, at 6:05 AM, Park Heesob wrote:
> 
> > # GMailer 0.0.8 Released
> > 
> > This is the 0.0.8 release of GMailer by Park Heesob.  
> > 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 and archiving message.
> > 
> > What's new in this release?  
> > ---------------------------
> > 
> > Rename is\_connected method to connected?  
> > Add support for the new feature 'Send mail as'. If you have multiple  
> > verified  
> > "Send mail as:" email addresses, you can choose one 'From:' email address.  
> > Refer to [http://gmail.google.com/support/bin/answer.py?answer=20616](http://gmail.google.com/support/bin/answer.py?answer=20616)  
> > Thanks Daniel Schierbeck and Michel Martens!
> > 
> > How to use GMailer?  
> > -----------------------  
> > Sample usage:
> > 
> > GMailer.connect(name,pwd) do |g|  
> > &nbsp;&nbsp;#fetch  
> > &nbsp;&nbsp;g.fetch(:label=\>"my\_label") {|s|  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "Total # of conversations of my\_label = " + s.box\_total.to\_s  
> > &nbsp;&nbsp;}
> > 
> > &nbsp;&nbsp;#get contact  
> > &nbsp;&nbsp;g.fetch(:contact=\>"freq").each do |item|  
> > &nbsp;&nbsp;&nbsp;&nbsp;puts "Name: #{item['name']} Email: #{item['email']}"  
> > &nbsp;&nbsp;end
> > 
> > &nbsp;&nbsp;#send message  
> > &nbsp;&nbsp;# 'From' default gmail.com account  
> > &nbsp;&nbsp;g.send(  
> > &nbsp;&nbsp;&nbsp;&nbsp;:to =\> "who@what.com, my\_friend@his\_company.com, god@heaven.org"  
> > &nbsp;&nbsp;&nbsp;&nbsp;:cc =\> "foo@bar.com"  
> > &nbsp;&nbsp;&nbsp;&nbsp;:subject =\> "Hello There!",  
> > &nbsp;&nbsp;&nbsp;&nbsp;:body =\> "Hi...\n\nBlah blah blah~~...",  
> > &nbsp;&nbsp;&nbsp;&nbsp;:files =\> ["./my\_pic.jpg", "./my\_cv.txt"])
> > 
> > &nbsp;&nbsp;# multiple verified email addresses and choose one 'From:' email address  
> > &nbsp;&nbsp;g.send(  
> > &nbsp;&nbsp;&nbsp;&nbsp;:from =\> "verified@email.com",  
> > &nbsp;&nbsp;&nbsp;&nbsp;:to =\> "who@what.com, my\_friend@his\_company.com, god@heaven.org"  
> > &nbsp;&nbsp;&nbsp;&nbsp;:cc =\> "foo@bar.com"  
> > &nbsp;&nbsp;&nbsp;&nbsp;:subject =\> "Hello There!",  
> > &nbsp;&nbsp;&nbsp;&nbsp;:body =\> "Hi...\n\nBlah blah blah~~...",  
> > &nbsp;&nbsp;&nbsp;&nbsp;:files =\> ["./my\_pic.jpg", "./my\_cv.txt"])
> > 
> > &nbsp;&nbsp;# update\_preference  
> > &nbsp;&nbsp;g.update\_preference(:max\_page\_size=\>50,  
> > &nbsp;&nbsp;&nbsp;&nbsp;:keyboard\_shortcuts=\>true,  
> > &nbsp;&nbsp;&nbsp;&nbsp;:indicators=\>true,  
> > &nbsp;&nbsp;&nbsp;&nbsp;:display\_language=\>'en',  
> > &nbsp;&nbsp;&nbsp;&nbsp;:signature=\>'This is a signature',  
> > &nbsp;&nbsp;&nbsp;&nbsp;:reply\_to=\>'return@foo.bar',  
> > &nbsp;&nbsp;&nbsp;&nbsp;:snippets=\>true,  
> > &nbsp;&nbsp;&nbsp;&nbsp;:display\_name=\>'Display Name')
> > 
> > &nbsp;&nbsp;# get preference  
> > &nbsp;&nbsp;pref = g.preference  
> > &nbsp;&nbsp;puts "Display language:#{pref['display\_language']}, Max Page  
> > Size:#{pref['max\_page\_size']}"
> > 
> > &nbsp;&nbsp;#creating new labels  
> > &nbsp;&nbsp;g.create\_label('label\_name')
> > 
> > &nbsp;&nbsp;#renaming existing labels  
> > &nbsp;&nbsp;g.rename\_label('label\_name','renamed\_label')
> > 
> > &nbsp;&nbsp;#deleting labels  
> > &nbsp;&nbsp;g.delete\_label('label\_name')
> > 
> > &nbsp;&nbsp;#applying a label to a message  
> > &nbsp;&nbsp;g.apply\_label(msgid,'label\_name')
> > 
> > &nbsp;&nbsp;#removing a label from a message  
> > &nbsp;&nbsp;g.remove\_label(msgid,'label\_name')
> > 
> > &nbsp;&nbsp;#apply star to a message  
> > &nbsp;&nbsp;g.apply\_star(msgid)
> > 
> > &nbsp;&nbsp;#remove star from a message  
> > &nbsp;&nbsp;g.remove\_star(msgid)
> > 
> > &nbsp;&nbsp;#archive a message  
> > &nbsp;&nbsp;g.archive(msgid)
> > 
> > &nbsp;&nbsp;#unarchive a message  
> > &nbsp;&nbsp;g.unarchive(msgid)
> > 
> > &nbsp;&nbsp;#mark a message as read  
> > &nbsp;&nbsp;g.mark\_read(msgid)
> > 
> > &nbsp;&nbsp;#mark a message as unread  
> > &nbsp;&nbsp;g.mark\_unread(msgid)
> > 
> > &nbsp;&nbsp;#report a message as not spam  
> > &nbsp;&nbsp;g.report\_spam(msgid)
> > 
> > &nbsp;&nbsp;#report a message as not spam  
> > &nbsp;&nbsp;g.not\_spam(msgid)
> > 
> > &nbsp;&nbsp;#move a message to trash  
> > &nbsp;&nbsp;g.trash\_in(msgid)
> > 
> > &nbsp;&nbsp;#move a message from trash to inbox  
> > &nbsp;&nbsp;g.trash\_out(msgid)
> > 
> > &nbsp;&nbsp;#delete a trash message forever  
> > &nbsp;&nbsp;g.delete\_trash(msgid)
> > 
> > &nbsp;&nbsp;#delete a spam message forever  
> > &nbsp;&nbsp;g.delete\_spam(msgid)
> > 
> > &nbsp;&nbsp;#get labels  
> > &nbsp;&nbsp;labels = g.labels
> > 
> > &nbsp;&nbsp;#get messages  
> > &nbsp;&nbsp;g.messages(:label=\>labels[0]).each {|m|  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "Subject: #{m['subject']} / Snippet: #{m['snippet']}" if m['new?']  
> > &nbsp;&nbsp;}
> > 
> > &nbsp;&nbsp;#get inbox messages  
> > &nbsp;&nbsp;g.messages(:standard=\>'inbox').each {|m|  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "Subject: #{m['subject']} / Snippet: #{m['snippet']}" if m['new?']  
> > &nbsp;&nbsp;}
> > 
> > end
> > 
> > Project:: [http://rubyforge.org/projects/gmailutils/](http://rubyforge.org/projects/gmailutils/)  
> > Bugs:: [http://rubyforge.org/tracker/?group\_id=869](http://rubyforge.org/tracker/?group_id=869)  
> > Document:: [http://rubyforge.org/docman/?group\_id=869](http://rubyforge.org/docman/?group_id=869)  
> > Download:: [http://rubyforge.org/frs/?group\_id=869](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  
> > [http://rubyforge.org/frs/?group\_id=869](http://rubyforge.org/frs/?group_id=869)  
> > and run install.rb
> > 
> > Cheers,
> > 
> > Park Heesob

---

<div class="post-metadata">

### Author: ![David\_Teare](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@David\_Teare](https://rubytalk.org/u/David_Teare)
#### Post date: [3 September 2005 17:34 UTC](https://rubytalk.org/t/ann-gmailer-0-0-8-released/20587/5 "2005-09-03T17:34:45Z")

</div>

+1 for this feature. Can we see it in version 0.0.9? 😉

> **···**
>
> On 3-Sep-05, at 1:26 PM, Daniel Schierbeck wrote:
> 
> > GMailer::connect(username, password) do |gmail|  
> > &nbsp;&nbsp;gmail.messages(:unread).each do |msg|  
> > &nbsp;&nbsp;&nbsp;&nbsp;puts "subject: " + msg.subject  
> > &nbsp;&nbsp;&nbsp;&nbsp;puts "from: " + msg.from  
> > &nbsp;&nbsp;end

---

<div class="post-metadata">

### Author: ![Daniel\_Schierbeck](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daniel\_Schierbeck](https://rubytalk.org/u/Daniel_Schierbeck)
#### Post date: [3 September 2005 17:41 UTC](https://rubytalk.org/t/ann-gmailer-0-0-8-released/20587/6 "2005-09-03T17:41:26Z")

</div>

That should of course be

....  
def GMailer.connect (...)  
....

---

<div class="post-metadata">

### Author: ![Mark\_Hubbart1](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@Mark\_Hubbart1](https://rubytalk.org/u/Mark_Hubbart1)
#### Post date: [3 September 2005 18:14 UTC](https://rubytalk.org/t/ann-gmailer-0-0-8-released/20587/7 "2005-09-03T18:14:09Z")

</div>

> Thanks for sharing this as a GEM.
> 
> I am having some troubles getting it to work. I installed gmailer  
> v0.8 but I can't figure out how to "require" it. Am I missing  
> something obvious?
> 
> $ gem list | grep gmail  
> gmailer (0.0.8)  
> $ ruby --version  
> ruby 1.8.2 (2004-12-25) [powerpc-darwin7.8.0]  
> $ gem --version  
> 0.8.10
> 
> $ irb  
> irb(main):001:0\> require "GMail"  
> LoadError: No such file to load -- GMail  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):1:in `require'  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):1  
> irb(main):002:0\> require "GMailer"  
> LoadError: No such file to load -- GMailer  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):2:in `require'  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):2  
> irb(main):003:0\> require "gmailer"  
> LoadError: No such file to load -- gmailer  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):3:in `require'  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):3

perhaps try:  
\>\> require 'rubygems'  
\>\> require\_gem 'gmailer'

cheers,  
Mark

> **···**
>
> On 9/3/05, David Teare \<dteare@tearesolutions.com\> wrote:

---

<div class="post-metadata">

### Author: ![Park\_Heesob1](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@Park\_Heesob1](https://rubytalk.org/u/Park_Heesob1)
#### Post date: [3 September 2005 23:46 UTC](https://rubytalk.org/t/ann-gmailer-0-0-8-released/20587/8 "2005-09-03T23:46:32Z")

</div>

Hi,

> From: Daniel Schierbeck \<daniel.schierbeck@gmail.com\>  
> Reply-To: ruby-talk@ruby-lang.org  
> To: ruby-talk@ruby-lang.org (ruby-talk ML)  
> Subject: Re: [ANN] gmailer-0.0.8 released  
> Date: Sun, 4 Sep 2005 02:26:26 +0900
> 
> One thing that would be cool is a more advanced API. Something along the lines of this:
> 
> Module GMailer  
> &nbsp;&nbsp;# the main class.  
> &nbsp;&nbsp;class Connection  
> &nbsp;&nbsp;&nbsp;&nbsp;# returns the messages that match the filters  
> &nbsp;&nbsp;&nbsp;&nbsp;# or all messages if no filter is provided  
> &nbsp;&nbsp;&nbsp;&nbsp;def messages (filters = {}); end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;# returns all labels  
> &nbsp;&nbsp;&nbsp;&nbsp;def labels; end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;# returns the label that has the name "name"  
> &nbsp;&nbsp;&nbsp;&nbsp;# as a Label object  
> &nbsp;&nbsp;&nbsp;&nbsp;def label (name); end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;# etc etc  
> &nbsp;&nbsp;end
> 
> &nbsp;&nbsp;# a list of messages. should be sortable and searchable.  
> &nbsp;&nbsp;class MessageList; end
> 
> &nbsp;&nbsp;# a single message  
> &nbsp;&nbsp;class Message  
> &nbsp;&nbsp;&nbsp;&nbsp;attr\_reader :subject, :body, :to, :from, :date
> 
> &nbsp;&nbsp;&nbsp;&nbsp;# applies a label to the message.  
> &nbsp;&nbsp;&nbsp;&nbsp;# can take either a string or a Label object as argument  
> &nbsp;&nbsp;&nbsp;&nbsp;def apply\_label (label); end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;def remove\_label; end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;def archive; end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;def unarchive; end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;def archived?; end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;def mark\_read; end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;def mark\_unread; end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;def read?; end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;def report\_spam; end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;def report\_not\_spam; end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;def spam?; end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;def trash; end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;def untrash; end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;# etc etc  
> &nbsp;&nbsp;end
> 
> &nbsp;&nbsp;class Label  
> &nbsp;&nbsp;&nbsp;&nbsp;# you get the picture  
> &nbsp;&nbsp;end
> 
> &nbsp;&nbsp;def connect (\*args, &block)  
> &nbsp;&nbsp;&nbsp;&nbsp;Connection.new(\*args, &block)  
> &nbsp;&nbsp;end  
> end
> 
> GMailer::connect(username, password) do |gmail|  
> &nbsp;&nbsp;gmail.messages(:unread).each do |msg|  
> &nbsp;&nbsp;&nbsp;&nbsp;puts "subject: " + msg.subject  
> &nbsp;&nbsp;&nbsp;&nbsp;puts "from: " + msg.from  
> &nbsp;&nbsp;end  
> end

Thanks for suggestions.  
I will try to satisfy you in the next release.🙂

In the mean time, you can use this for fetching each message content:

g.messages(:standard=\>'all').each {|m|  
&nbsp;&nbsp;&nbsp;&nbsp;puts "ID: #{m['id']} Subject: #{m['subject']} / Snippet: #{m['snippet']}"  
&nbsp;&nbsp;&nbsp;&nbsp;g.fetch(:conversation=\>m['id']).conv.each {|c|  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "From: #{c['sender']} #{c['sender\_email']}"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "Subject: #{c['subject']}"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts "Full Message Body: #{c['body']}"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
}

Regards,

Park Heesob

---

<div class="post-metadata">

### Author: ![David\_Teare](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@David\_Teare](https://rubytalk.org/u/David_Teare)
#### Post date: [3 September 2005 18:54 UTC](https://rubytalk.org/t/ann-gmailer-0-0-8-released/20587/9 "2005-09-03T18:54:44Z")

</div>

The require\_gem seemed to work (it returned true), but I still had the error below. No worries though, I just downloaded the rb code and included it directly - it works great now!

NameError: uninitialized constant GMailer  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):9

> **···**
>
> On 3-Sep-05, at 2:14 PM, Mark Hubbart wrote:
> 
> > On 9/3/05, David Teare \<dteare@tearesolutions.com\> wrote:
> > 
> > > Thanks for sharing this as a GEM.
> > > 
> > > I am having some troubles getting it to work. I installed gmailer  
> > > v0.8 but I can't figure out how to "require" it. Am I missing  
> > > something obvious?
> > > 
> > > $ gem list | grep gmail  
> > > gmailer (0.0.8)  
> > > $ ruby --version  
> > > ruby 1.8.2 (2004-12-25) [powerpc-darwin7.8.0]  
> > > $ gem --version  
> > > 0.8.10
> > > 
> > > $ irb  
> > > irb(main):001:0\> require "GMail"  
> > > LoadError: No such file to load -- GMail  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):1:in `require'  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):1  
> > > irb(main):002:0\> require "GMailer"  
> > > LoadError: No such file to load -- GMailer  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):2:in `require'  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):2  
> > > irb(main):003:0\> require "gmailer"  
> > > LoadError: No such file to load -- gmailer  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):3:in `require'  
> > > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):3
> > 
> > perhaps try:
> > 
> > > > require 'rubygems'  
> > > > require\_gem 'gmailer'
> > 
> > cheers,  
> > Mark
