Closed ghost closed 11 years ago
This form works for me...
gmail = Gmail.new(credentials.username, credentials.password) do |gmail| inbox = gmail.inbox inbox.emails(:unread).each do |email| puts email.body emails.body.parts.each do |part| puts part.decoded end end end
I agree with you about lack of docs.
ruby-gmail wraps TMail, so the missing docs can be found by looking at it: http://tmail.rubyforge.org/rdoc/index.html
Thanks for your comments pfarrell, helped me out!
@pfarrell did you know how to get the time of the mail. this is my code
messages = ""
gmail.inbox.emails(:unread).each do |email|
email.from.each do |info|
messages += info.name
end
messages += email.subject+"\n\n"
end
Thanks for all the tips here and I am going to close this out. If anyone has time to fork and update the README it would be appreciated.
Hello, Im still trying to read a message from within the inbox. I have connected to the server, found the list of messages, but am unsure what method I should be using to actually view the body of the message.
Using: gmail.inbox.emails(:unread, :from => mailaddress).each do |email| email.message Popped the error "undefined method: message" This pops up for .read, .body.. etc Am I doing it wrong?