# NET::IMAP / Runner problems

**URL:** <https://www.ruby-forum.com/t/net-imap-runner-problems/80581>\
**Category:** Rails\
**Created:** [December 28, 2006, 8:55pm UTC](https://www.ruby-forum.com/t/net-imap-runner-problems/80581 "2006-12-28T20:55:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsimone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jsimone](https://www.ruby-forum.com/u/jsimone)\
**Post date:** [December 28, 2006, 8:55pm UTC](https://www.ruby-forum.com/t/net-imap-runner-problems/80581/1 "2006-12-28T20:55:54Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jsimone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jsimone](https://www.ruby-forum.com/u/jsimone)\
**Post date:** [December 28, 2006, 9:14pm UTC](https://www.ruby-forum.com/t/net-imap-runner-problems/80581/2 "2006-12-28T21:14:33Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jsimone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jsimone](https://www.ruby-forum.com/u/jsimone)\
**Post date:** [December 28, 2006, 9:19pm UTC](https://www.ruby-forum.com/t/net-imap-runner-problems/80581/3 "2006-12-28T21:19:11Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![jsimone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jsimone](https://www.ruby-forum.com/u/jsimone)\
**Post date:** [December 28, 2006, 11:03pm UTC](https://www.ruby-forum.com/t/net-imap-runner-problems/80581/4 "2006-12-28T23:03:59Z")

</div>

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.
