Comments (9)
I am having the same problem under ruby 1.9.3
from ruby-gmail.
Can you post a code example? And can you upgrade and try the newest gem version?
from ruby-gmail.
I am also having this issue on Ruby 1.9.3 using 0.3.0.
folder = "/home/refriedchicken/downloads"
Gmail.new('username','password') do |g|
g.inbox.emails(:unread, :from => "[email protected]").each do |e|
if !e.message.attachments.empty?
e.message.save_attachments_to(folder)
e.mark(:read)
e.archive!
end
end
end
NoMethodError: undefined method message' for #<Mail::Message:0x0000000273f800> from /home/refriedchicken/.rvm/gems/ruby-1.9.3-p374/gems/mail-2.5.3/lib/mail/message.rb:1289:in
method_missing'
from /home/refriedchicken/.rvm/gems/ruby-1.9.3-p374/gems/ruby-gmail-0.3.0/lib/gmail/message.rb:101:in method_missing' from (irb):30:in
block (2 levels) in irb_binding'
from (irb):29:in each' from (irb):29:in
block in irb_binding'
from /home/refriedchicken/.rvm/gems/ruby-1.9.3-p374/gems/ruby-gmail-0.3.0/lib/gmail.rb:24:in initialize' from (irb):28:in
new'
from (irb):28
from /home/refriedchicken/.rvm/rubies/ruby-1.9.3-p374/bin/irb:13:in `
from ruby-gmail.
Hi,
I solved with code below. The ruby version is ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.2.0]
File.open(File.join("imgs", file.filename), "w+b", 0644 ) { |f| f.write file.body.decoded }
Thank's
from ruby-gmail.
I am too face the same problem. I have using ruby 2.0.0-p247 and ruby-gmail-0.3.0.
Any work around?
from ruby-gmail.
I got the same problem, it appears the save_attachments_to method doesnt exist or has been deprecated by the mail gem. I was able to handle my attachments like so
message.attachments.each do |attachment|
File.open("/home/rcho/Downloads/#{attachment.filename}", "w+b", 0644) { |f| f.write attachment.body.decoded }
end
source: https://github.com/mikel/mail#testing-and-extracting-attachments
from ruby-gmail.
Seems that in version 0.3.0 author made method 'message' private. At master I see that this method is public, so I assume that it was done mistakenly. For fast fixing this we can use send:
g.inbox.emails(:unread, :from => "[email protected]").each do |e|
e.send(:message).save_attachments_to(folder)
end
from ruby-gmail.
@rcho's method doesn't work for me, which makes sense since it's still relying on the message method. I had no better results using emails.send(:message).save_attachments_to(folder). I get undefined method `save_attachments_to' for #Mail::Message:0x00000101469608
from ruby-gmail.
@Dreyfuzz @dolgishev I've merged a PR that updated the README. Can you try to save the attachments manually?
The #save_attachments_to method was very out of date and the new example should work.
from ruby-gmail.
Related Issues (20)
- Special characters in the :gm search option
- Can't send, then receive on the same session.
- Reading a message marks the message as read
- How do I select an email given it's id?
- Uncaught exception: 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbuO6
- Open invitation: let's combine efforts at gmailgem/gmail
- How can I retrieve archived messages HOT 1
- No way to tell if I'm logged in
- Support for charset
- Gem is unusable, "Please log in via your web browser" HOT 7
- Google prevents signin HOT 1
- archive doesn't seem to work
- Collect email subject and body
- Sent emails
- Wrong format in to_imap_date method HOT 4
- How do I read the mail content? HOT 1
- How I can disable log message in stderr?
- <Net::IMAP::NoResponseError: Please log in via your web browser
- Managing HOT 1
- Impact on "Insecure apps disable connection to G Suite accounts"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ruby-gmail.