Hey
Here is my code:
______________________________________________________________
#!/usr/bin/env ruby
#You might want to change this
ENV["RAILS_ENV"] ||= "development"
require File.dirname(__FILE__) + "/../../config/environment"
require "net/pop"
$running = true;
Signal.trap("TERM") do
$running = false
end
while($running) do
Net::POP3.start(''mail.mylittlesecret.co.uk'',110,
''test+mylittlesecret.co.uk'',''password'') do
|mail|
unless mail.mails.empty?
mail.mails.each do |n|
#some saving goes here e.g.
#email = Email.new
#email.from = n.from
#email.body = n.body
#email.save
ActiveRecord::Base.logger << "messages saved\n"
end
else
ActiveRecord::Base.logger << "Error\n"
end
end
sleep 10
end
--------------------------------------------------------------
Is there a way I can split the email up like this (where the comments
are)? I''ve looked through the Net::pop documentation but I couldnt see
anything about saving to a database, only file based.
Thanks, Red
--
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
-~----------~----~----~----~------~----~------~--~---