P
Park Heesob
GMailer 0.1.0 Released
=======================
This is the 0.1.0 release of GMailer by Park Heesob.
This is a class library for interface to Google's webmail service.
What is GMailer?
-----------------
GMailer can fetch mails, save attachements, get cotact lists, invite someone
or send message with file attachments. It provides edit methods for labels,
preferece settings, starring and archiving message.
What's new in this release?
---------------------------
Remove all hash return values.
Add some classes like Contact, Filter, Box, Converation.
Now all return value is Class or Array of classes.
Add msg method for message based operation.
Add each and each_msg method for MessageList.
Thanks Daniel Schierbeck and Gavin!
How to use GMailer?
-----------------------
Sample usage:
require 'gmailer'
GMailer.connect(name,pwd) do |g|
#fetch
g.messages
label=>"my_label") do |ml|
puts "Total # of conversations of my_label = " + ml.total.to_s
end
#get contact
g.fetch
contact=>"freq").each do |contact|
puts "Name: #{contact.name} Email: #{contact.email}"
end
#send message
# 'From' default gmail.com account
g.send(
:to => "(e-mail address removed), my_friend@his_company.com, (e-mail address removed)",
:cc => "(e-mail address removed)",
:subject => "Hello There!",
:body => "Hi...\n\nBlah blah blah~...",
:files => ["./my_pic.jpg", "./my_cv.txt"])
# multiple verified email addresses and choose one 'From:' email address
g.send(
:from => "(e-mail address removed)",
:to => "(e-mail address removed), my_friend@his_company.com, (e-mail address removed)",
:cc => "(e-mail address removed)",
:subject => "Hello There!",
:body => "Hi...\n\nBlah blah blah~...",
:files => ["./my_pic.jpg", "./my_cv.txt"])
# update_preference
g.update_preference
max_page_size=>50,
:keyboard_shortcuts=>true,
:indicators=>true,
:display_language=>'en',
:signature=>'This is a signature',
:reply_to=>'(e-mail address removed)',
:snippets=>true,
:display_name=>'Display Name')
# get preference
pref = g.preference
puts "Language:#{pref.display_language}, Page Size:#{pref.max_page_size}"
#creating new labels
g.create_label('label_name')
#renaming existing labels
g.rename_label('label_name','renamed_label')
#deleting labels
g.delete_label('label_name')
#applying a label to a message
m.msg(msgid).apply_label('label_name')
# message id based operation
g.msg(msgid) {|m|
#applying a label to a message
m.apply_label('label_name')
#removing a label from a message
m.apply_label('label_name')
#apply star to a message
m.apply_star
#remove star from a message
m.remove_star
#archive a message
m.archive
#unarchive a message
m.unarchive
#mark a message as read
m.mark_read
#mark a message as unread
m.mark_unread
#report a message as not spam
m.report_spam
#report a message as not spam
m.report_not_spam
#move a message to trash
m.trash
#move a message from trash to inbox
m.untrash
#delete a message forever
m.delete
#show original message
m.original
end
#get labels
labels = g.labels
#get messages list
g.messages
label=>labels[0]).each {|m|
puts "Subject: #{m.subject}" if m.new?
}
#get inbox messages list
g.messages
standard=>'inbox').each {|m|
puts "Subject: #{m.subject}" if m.new?
}
# fetch each converation with filter :read or :star
g.messages
standard=>'all',:read=>false).each_msg {|msg|
# operations on the message
msg.apply_star
msg.apply_label(label)
msg.trash
puts "subject: " + msg.subject
puts "from: " + msg.sender
puts msg.body
puts msg.original
}
end
Regards,
Park Heesob
=======================
This is the 0.1.0 release of GMailer by Park Heesob.
This is a class library for interface to Google's webmail service.
What is GMailer?
-----------------
GMailer can fetch mails, save attachements, get cotact lists, invite someone
or send message with file attachments. It provides edit methods for labels,
preferece settings, starring and archiving message.
What's new in this release?
---------------------------
Remove all hash return values.
Add some classes like Contact, Filter, Box, Converation.
Now all return value is Class or Array of classes.
Add msg method for message based operation.
Add each and each_msg method for MessageList.
Thanks Daniel Schierbeck and Gavin!
How to use GMailer?
-----------------------
Sample usage:
require 'gmailer'
GMailer.connect(name,pwd) do |g|
#fetch
g.messages
puts "Total # of conversations of my_label = " + ml.total.to_s
end
#get contact
g.fetch
puts "Name: #{contact.name} Email: #{contact.email}"
end
#send message
# 'From' default gmail.com account
g.send(
:to => "(e-mail address removed), my_friend@his_company.com, (e-mail address removed)",
:cc => "(e-mail address removed)",
:subject => "Hello There!",
:body => "Hi...\n\nBlah blah blah~...",
:files => ["./my_pic.jpg", "./my_cv.txt"])
# multiple verified email addresses and choose one 'From:' email address
g.send(
:from => "(e-mail address removed)",
:to => "(e-mail address removed), my_friend@his_company.com, (e-mail address removed)",
:cc => "(e-mail address removed)",
:subject => "Hello There!",
:body => "Hi...\n\nBlah blah blah~...",
:files => ["./my_pic.jpg", "./my_cv.txt"])
# update_preference
g.update_preference
:keyboard_shortcuts=>true,
:indicators=>true,
:display_language=>'en',
:signature=>'This is a signature',
:reply_to=>'(e-mail address removed)',
:snippets=>true,
:display_name=>'Display Name')
# get preference
pref = g.preference
puts "Language:#{pref.display_language}, Page Size:#{pref.max_page_size}"
#creating new labels
g.create_label('label_name')
#renaming existing labels
g.rename_label('label_name','renamed_label')
#deleting labels
g.delete_label('label_name')
#applying a label to a message
m.msg(msgid).apply_label('label_name')
# message id based operation
g.msg(msgid) {|m|
#applying a label to a message
m.apply_label('label_name')
#removing a label from a message
m.apply_label('label_name')
#apply star to a message
m.apply_star
#remove star from a message
m.remove_star
#archive a message
m.archive
#unarchive a message
m.unarchive
#mark a message as read
m.mark_read
#mark a message as unread
m.mark_unread
#report a message as not spam
m.report_spam
#report a message as not spam
m.report_not_spam
#move a message to trash
m.trash
#move a message from trash to inbox
m.untrash
#delete a message forever
m.delete
#show original message
m.original
end
#get labels
labels = g.labels
#get messages list
g.messages
puts "Subject: #{m.subject}" if m.new?
}
#get inbox messages list
g.messages
puts "Subject: #{m.subject}" if m.new?
}
# fetch each converation with filter :read or :star
g.messages
# operations on the message
msg.apply_star
msg.apply_label(label)
msg.trash
puts "subject: " + msg.subject
puts "from: " + msg.sender
puts msg.body
puts msg.original
}
end
Regards,
Park Heesob