P
Park Heesob
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. You can make GMail as an online
backup system or as a virtual filesystem with this library.
Now usage is very simple and compact like this:
GMailer.connect(name,pwd) do |g|
#fetch
g.fetchlabel=>"my_label") {|snapshot|
puts "Total # of conversations of my_label = " +
snapshot.box_total.to_s
}
#get contact
g.fetchcontact=>"freq").each do |item|
puts "Name: #{item['name']} Email: #{item['email']}"
end
#send
g.send(
:to => "(e-mail address removed)",
:subj => "Hello There!",
:body => "Hi...\n\nBlah blah blah~...",
:files => ["./test.txt"]
)
# get labels
labels = g.get_labels
# get messages
g.get_messageslabel=>labels[0]).each {|m|
puts "Subject: #{m['subj']} / Snippet: #{m['snippet']}" if m['new?']
}
end
Now you can connect with proxy server like this
GMailer.connectusername=>name,assword=>pwd,
roxy_host=>proxy,roxy_port=>8080,
roxy_user=>user,roxy_pass=>pass) { |g|
...
}
But proxy connection needs some tests.
Project:: http://rubyforge.org/projects/gmailutils/
Bugs:: http://rubyforge.org/tracker/?group_id=869
Regards,
Park Heesob
It can fetch mails, save attachements, get cotact lists, invite someone
or send message with file attachments. You can make GMail as an online
backup system or as a virtual filesystem with this library.
Now usage is very simple and compact like this:
GMailer.connect(name,pwd) do |g|
#fetch
g.fetchlabel=>"my_label") {|snapshot|
puts "Total # of conversations of my_label = " +
snapshot.box_total.to_s
}
#get contact
g.fetchcontact=>"freq").each do |item|
puts "Name: #{item['name']} Email: #{item['email']}"
end
#send
g.send(
:to => "(e-mail address removed)",
:subj => "Hello There!",
:body => "Hi...\n\nBlah blah blah~...",
:files => ["./test.txt"]
)
# get labels
labels = g.get_labels
# get messages
g.get_messageslabel=>labels[0]).each {|m|
puts "Subject: #{m['subj']} / Snippet: #{m['snippet']}" if m['new?']
}
end
Now you can connect with proxy server like this
GMailer.connectusername=>name,assword=>pwd,
roxy_host=>proxy,roxy_port=>8080,
roxy_user=>user,roxy_pass=>pass) { |g|
...
}
But proxy connection needs some tests.
Project:: http://rubyforge.org/projects/gmailutils/
Bugs:: http://rubyforge.org/tracker/?group_id=869
Regards,
Park Heesob