dcparker / ruby-gmail

A Rubyesque interface to Gmail. Connect to Gmail via IMAP and manipulate emails and labels. Send email with your Gmail account via SMTP. Includes full support for parsing and generating MIME messages.
http://dcparker.github.com/ruby-gmail
790 stars 123 forks source link

error with attachment #41

Closed chebyte closed 11 years ago

chebyte commented 12 years ago

hi there i have a problem with I tried to access to attachment file, this is my code

gmail.inbox.emails.each do |email|
  if !email.message.attachments.empty?
    email.attachments[0].save_to_file("~/")
  end
end

and this is the error that it throws

gems/mail-2.4.4/lib/mail/message.rb:1289:in `method_missing': undefined method `save_to_file' for #<Mail::Part:0x007ffca9a11d98> (NoMethodError)
myobie commented 11 years ago

save_to_file is not a method of Mail::Part so that is an error in the README. I apologize for this and I'll try to add a better example. If you did manage to get this to work then please fork and update the README, thanks.