I have installed gmailer gem.but i got some error when i tried to
connect
my gmail account.i need to get the inbox messages from my gmail
account.but i can't.plzz help me.i got "You have a nil object when you
didn't expect it!
The error occurred while evaluating nil.connection= error".i got tis
eror when i used g.messages line in my code.my code is
require 'rubygems'
require 'gmailer'
class FirstController < ApplicationController
def index
count=0
puts "lllllllllll"
if GMailer.connect('myaccountgmail.com', 'password')
puts "CONNECTED"
begin
GMailer.connect('[email protected]', 'password') do |g|
puts "GGGGGGGG enter"
puts g.inspect
g.messages(:label => "inbox") do |ml|
ml.each_msg do |conversation|
Email.create!(
:title => conversation.subject,
:text => conversation.body,
:sender => conversation.sender,
:sender_email => conversation.sender_email,
:reply_email => (conversation.reply_email.blank?) ?
conversation.sender_email : conversation.reply_email
)
count += 1
puts conversation.archive
end
end
end #connect
rescue Exception => e
puts e
end
end
count
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---