[ANN] gmailer 0.0.1 (plain text)

Hi,

Sorry for previous encoding message.

I'm happy to announce first version of GMailer, a class for interface to
Google's webmail service.

You can fetching gmails

   require "gmailer"

   gmail = GMailer.new
   gmail.setLoginInfo(name, pwd)
   if gmail.connect
      gmail.fetchBox(GM_LABEL, "my_label", 0)
      snapshot = gmail.getSnapshot(GM_LABEL)
      if snapshot
         puts "Total # of conversations of my_label = " +
snapshot.box_total.to_s

      end
      gmail.disconnect
   end

Sending new gmails

   require "gmailer"

   gmail = GMailer.new
   gmail.setLoginInfo(name, pwd)
   if gmail.connect
      to = "who@what.com, my_friend@his_company.com, god@heaven.org"
      cc = "foo@bar.com"
      subj = "Hello There!"
      message = "Hi...\n\nBlah blah blah~..."
      attachments = ["./my_pic.jpg", "./my_cv.txt"]
      gmail.send(to, subj, message, cc, '','', '', attachments, false, '')
   end

Or playing around with contact list

   require "gmailer"

   gmail = GMailer.new
   gmail.setLoginInfo(name, pwd)
   if gmail.connect
      gmail.fetchBox(GM_CONTACT, "freq", 0)
      snapshot = gmail.getSnapshot(GM_CONTACT)
      puts "Your frequently used addresses:"
      snapshot.contacts.each { |item|
         puts "Name: " + item["name"] + ", Email: " + item["email"]
      }
   end

You can find out more about GMailer at:

http://rubyforge.org/projects/gmailutils

Enjoy!

Park Heesob

I'm happy to announce first version of GMailer, a class for interface to Google's webmail service.

very nice, thanks!

martinus

Hi Park,

Thanks for the quick release :wink:

I had a problem with this "attachment" part:

<snip>

   require "gmailer"

   gmail = GMailer.new
   gmail.setLoginInfo(name, pwd)
   if gmail.connect
      to = "who@what.com, my_friend@his_company.com, god@heaven.org"
      cc = "foo@bar.com"
      subj = "Hello There!"
      message = "Hi...\n\nBlah blah blah~..."
      attachments = ["./my_pic.jpg", "./my_cv.txt"]

                      ^^^^^^^^^^^^^^^^
On Windows, with ruby 1.8.2 (2004-12-25) [i386-mswin32], I had a problem
sending binary attachments. Also, I saw a lot of debug stuff flying across
the screen.

      gmail.send(to, subj, message, cc, '','', '', attachments, false, '')
   end

<snip>

I fixed the first problem by changing line 466 of your gmailer.rb from this:

   content = File.open(f){ |c| c.read }

to this:

   content = File.open(f,"rb"){ |c| c.read }

And I fixed the second problem by commenting out line 478 of gmailer.rb:

   np.set_debug_output($stderr)

No big deal ... thought I would share it with you. You will surely have
a better way to change it :slight_smile:

-- shanko

···

____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs

Hi,

I fixed the first problem by changing line 466 of your gmailer.rb from
this:

  content = File.open(f){ |c| c.read }

to this:

  content = File.open(f,"rb"){ |c| c.read }

And I fixed the second problem by commenting out line 478 of gmailer.rb:

  np.set_debug_output($stderr)

No big deal ... thought I would share it with you. You will surely have
a better way to change it :slight_smile:

-- shanko

Thanks for your fix.

I updated the CVS and the release version.

Regards,

Park Heesob

It works with proxy, just by adding in initialize():

<code to detect proxy>
@http_conn = proxy?(Net::HTTP::Proxy(proxy, port)):(Net::HTTP)

and using @http_conn.new(...) instead of Net::HTTP.new(...) later on.

···

--
btw, do you have any idea how often it will break? AFAIK google does
not like such libraries...

Hi,

From: "Konstantin Levinski"
Reply-To: ruby-talk@ruby-lang.org
To: ruby-talk@ruby-lang.org (ruby-talk ML)
Subject: Re: gmailer 0.0.1 (plain text)
Date: Fri, 19 Aug 2005 11:11:15 +0900

It works with proxy, just by adding in initialize():

<code to detect proxy>
@http_conn = proxy?(Net::HTTP::Proxy(proxy, port)):(Net::HTTP)

and using @http_conn.new(...) instead of Net::HTTP.new(...) later on.

Thanks for your code.
I will add it in the next version.

--
btw, do you have any idea how often it will break? AFAIK google does
not like such libraries...

I know Google does not endorse third party applications meant to interact with Gmail.
But, AFAIK Goolgle also made the Gmail Notifier with Gmail Agent API(http://johnvey.com/features/gmailapi/\)

Regards,

Park Heesob