Hi,
I would like 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
Very cool! Its great to see people flesh out the RAA with interesting
and useful projects. And I can tell that you really made an effort to
create a high quality library. Thanks!
As a potenial user of your library, here are some suggestions about
your API (not that you asked, so feel free to ignore me if you're not
interested). How about something like this:
GMailer::connect(name, pwd) do |g|
g.send do
to "me@here.org"
subject "Testing"
message "This is a test"
attach "myfile.txt"
attach "anotherfile"
end
g.fetch(:label=>"ruby-talk") do |b|
puts "Total messages: #{b.box_total}"
end
g.fetch(:contact=>"freq").each do |item|
puts "Name: #{item.name} Email: #{item.email}"
end
end
In addition, I'd like to see the library use ruby's default arguments
to avoid having to tack on a 0 or a 'false' or an empty string at the
end of a parameter list. I'm lazy.
Enjoy!
We will
Dan
Hi,
Looks like an awesome interface
What service / interface does this use to get at gmail? This doesn't violate Google's terms of service in any way?
Cheers,
Mike
···
On Aug 16, 2005, at 9:43 AM, Park Heesob wrote:
Hi,
I would like 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
Hi,
Very cool! Its great to see people flesh out the RAA with interesting
and useful projects. And I can tell that you really made an effort to
create a high quality library. Thanks!
As a potenial user of your library, here are some suggestions about
your API (not that you asked, so feel free to ignore me if you're not
interested). How about something like this:
GMailer::connect(name, pwd) do |g|
g.send do
to "me@here.org"
subject "Testing"
message "This is a test"
attach "myfile.txt"
attach "anotherfile"
end
g.fetch(:label=>"ruby-talk") do |b|
puts "Total messages: #{b.box_total}"
end
g.fetch(:contact=>"freq").each do |item|
puts "Name: #{item.name} Email: #{item.email}"
end
end
In addition, I'd like to see the library use ruby's default arguments
to avoid having to tack on a 0 or a 'false' or an empty string at the
end of a parameter list. I'm lazy.
Enjoy!
We will
Dan
Thanks for your suggestions.
The next version will relase in a few days.
I will make it more compatible for your wish.
For any suggestions or bugs, please use
http://rubyforge.org/tracker/?group_id=869
Regards,
Park Heesob