foreach

foreach(address, port = nil, account = nil, password = nil, isapop = false)
Class Public methods

Starts a POP3 session and iterates over each POPMail object, yielding it to the block. This method is equivalent to:

Net::POP3.start(address, port, account, password) do |pop|
  pop.each_mail do |m|
    yield m
  end
end

This method raises a POPAuthenticationError if authentication fails.

Example

Net::POP3.foreach('pop.example.com', 110,
                  'YourAccount', 'YourPassword') do |m|
  file.write m.pop
  m.delete if $DELETE
end
doc_ruby_on_rails
2015-04-22 05:22:13
Comments
Leave a Comment

Please login to continue.