[ANN] gmailer 0.0.1 (plain text)

P

Park Heesob

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 = "(e-mail address removed), my_friend@his_company.com, (e-mail address removed)"
cc = "(e-mail address removed)"
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
 
S

Shashank Date

Hi Park,

Thanks for the quick release ;-)

I had a problem with this "attachment" part:

=20
require "gmailer"
=20
gmail =3D GMailer.new
gmail.setLoginInfo(name, pwd)
if gmail.connect
to =3D "(e-mail address removed), my_friend@his_company.com, (e-mail address removed)"
cc =3D "(e-mail address removed)"
subj =3D "Hello There!"
message =3D "Hi...\n\nBlah blah blah~..."
attachments =3D ["./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 acros=
s=20
the screen.
=20
gmail.send(to, subj, message, cc, '','', '', attachments, false, = '')
end
=20
<snip>

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

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

to this:

content =3D 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 :)

-- shanko


=20



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

Park Heesob

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 :)

-- shanko
Thanks for your fix.

I updated the CVS and the release version.

Regards,

Park Heesob
 
K

Konstantin Levinski

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.
 
P

Park Heesob

Hi,
From: "Konstantin Levinski"
Reply-To: (e-mail address removed)
To: (e-mail address removed) (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.
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

[ANN] gmailer 0.0.9 2
[ANN] gmailer 0.0.3 3
[ANN] gmailer-0.0.8 released 8
[ANN] gmailer 0.1.0 3
[ANN] gmailer-0.0.7 2
[ANN] gmailer-0.0.5 0
[ANN] gmailer-0.0.2 2
[ANN] dike-0.0.1 - a memory leak detector 18

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top