RubyでのGmailの読み込み失敗
ruby-gmailってgemで読み込めない><
なんかバグ踏んだ?
ruby-1.9.2-p180 :001 > require 'gmail' ruby-1.9.2-p180 :002 > gmail = Gmail.new("hogehoge@gmail.com","hogehoge_password") ruby-1.9.2-p180 :003 > email = gmail.inbox.emails(:all).first ruby-1.9.2-p180 :004 > email.attachments[0].save_to_file() IndexError: index 0 outside of array bounds: 0...0 from /home/hoge/.rvm/gems/ruby-1.9.2-p180/gems/mail-2.3.0/lib/mail/attachments_list.rb:33:in `fetch' from /home/hoge/.rvm/gems/ruby-1.9.2-p180/gems/mail-2.3.0/lib/mail/attachments_list.rb:33:in `[]' from (irb):4 from /home/hoge/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>'
GitHub - 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.にある
他のreadmeのサンプルは、まあ動いてるんだが><
P.S. 20110624
まあメール本文が取りたかったんですが、なんとなくbodyにしたら取れたw<
ruby-1.9.2-p180 :001 > require 'gmail' ruby-1.9.2-p180 :002 > gmail = Gmail.new("hogehoge@gmail.com","hogehoge_password") ruby-1.9.2-p180 :003 > gmail.inbox.emails(:all).first ruby-1.9.2-p180 :004 > email.body
ん〜、ナンテコッタ++