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.
CHANGE since 0.0.3 (preivious code could break)
- Remove camelCase methods
- Fix some bugs
- Modify some key name
subj -> subject , mid -> msg_id, tid -> thread_id, orig_df -> draft_id
Thanks James and Shanko!
The usage is very simple and compact like this:
GMailer.connect(name,pwd) do |g|
#fetch
g.fetch(:label=>"my_label") {|snapshot|
puts "Total # of conversations of my_label = " +
snapshot.box_total.to_s
}
#get contact
g.fetch(:contact=>"freq").each do |item|
puts "Name: #{item['name']} Email: #{item['email']}"
end
#send
g.send(
:to => "whoo@foo.bar",
:subject => "Hello There!",
:body => "Hi...\n\nBlah blah blah~...",
:files => ["./test.txt"]
)
# get labels
labels = g.get_labels
# get messages
g.get_messages(:label=>labels[0]).each {|m|
puts "Subject: #{m['subject']} / Snippet: #{m['snippet']}" if m['new?']
}
end
Now you can connect with proxy server like this
GMailer.connect(:username=>name,:password=>pwd,
:proxy_host=>proxy,:proxy_port=>8080,
:proxy_user=>user,:proxy_pass=>pass) { |g|
...
}
But proxy connection needs some tests.
I know the following error message still exists for proxy connection.
getaddrinfo: servname not supported for ai_socktype. (SocketError)
What this message means? what is the workaround?
Project:: http://rubyforge.org/projects/gmailutils/
Bugs:: http://rubyforge.org/tracker/?group_id=869
Regards,
Park Heesob