Class: ChocolateRain::MailFetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/chocolate_rain/inbox.rb

Class Method Summary collapse

Class Method Details

.startObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/chocolate_rain/inbox.rb', line 7

def self.start
  puts "in start"
  pop = Net::POP3.new('mail.hasflavor.com')
  pop.start("[email protected]", "oi890po")

  if !pop.mails.empty?
    pop.each_mail do |m|
      puts "new mail"
      ChocolateRain::MailHandler.receive(m.pop)
      m.delete
    end
  end
  puts 'done poppin'
  pop.finish
end