End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
Net::POP3.foreach
foreach(address, port = nil, account = nil, password = nil, isapop = false) { |message| ... }
lib/net/pop.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/net/pop.rb, line 262
def POP3.foreach(address, port = nil,
account = nil, password = nil,
isapop = false, &block) # :yields: message
start(address, port, account, password, isapop) {|pop|
pop.each_mail(&block)
}
end
Starts a POP3 session and iterates over each POPMail object, yielding it to the block. This method is equivalent to:
Example
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
Example
Net::POP3.foreach('pop.example.com', 110, 'YourAccount', 'YourPassword') do |m| file.write m.pop m.delete if $DELETE end