Hello,
I have a runner script that is meant to check a mailbox using imap and
insert them into the application. The method I am using to do this was
taken directly off the rails wiki:
require ''net/imap'' # above the class, not within it
def self.check_mail
imap = Net::IMAP.new(''localhost'')
imap.authenticate(''LOGIN'', ''username'',
''password'')
imap.select(''INBOX'')
imap.search([''ALL'']).each do |message_id|
msg =
imap.fetch(message_id,''RFC822'')[0].attr[''RFC822'']
MailReader.receive(msg)
#Mark message as deleted and it will be removed from storage when
user session closd
imap.store(message_id, "+FLAGS", [:Deleted])
end
end
The following is the output I receive when I run the runner script:
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/runner.rb:27:
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in
`const_missing'': uninitialized constant SSL (NameError)
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in
`const_missing''
from /usr/lib/ruby/1.8/net/imap.rb:204
from
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require''
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require''
from script/../config/../app/models/mailer.rb:1
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:140:in
`load''
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:56:in
`require_or_load''
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:30:in
`depend_on''
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:85:in
`require_dependency''
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:98:in
`const_missing''
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in
`const_missing''
from (eval):1
from
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `eval''
from
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/runner.rb:27
from
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require''
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require''
from script/runner:3
Any ideas?
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
I''ve narrowed it down to an issue with ''net/imap'', if I comment out everything but the require line the same errors occur. Does net/imap require OpenSSL be installed or something? -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
And another discovery... it only happens in the Rails environment. If I type "require ''net/imap''" into the rails console I get:>> require ''net/imap''NameError: uninitialized constant SSL from /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in `const_missing'' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in `const_missing'' from /usr/lib/ruby/1.8/net/imap.rb:204 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'' from (irb):1 however when I type it into irb it get no error at all.. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I commented out line 204 of /usr/lib/ruby/1.8/net/imap and it worked fine afterwards. I''m guessing that ubuntu doesn''t have some package installed by default that other distros do.... (like SendMail and GCC....) It will probably cause me more problems down the road, but at least for now I can use net/imap. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---