class Mail::POP3

def start(config = Mail::Configuration.instance, &block)

Start a POP3 session and ensures that it will be closed in any case.
def start(config = Mail::Configuration.instance, &block)
  raise ArgumentError.new("Mail::Retrievable#pop3_start takes a block") unless block_given?

  pop3 = Net::POP3.new(settings[:address], settings[:port], isapop = false)
  pop3.enable_ssl(verify = OpenSSL::SSL::VERIFY_NONE) if settings[:enable_ssl]
  pop3.start(settings[:user_name], settings[:password])

  yield pop3
ensure
  if defined?(pop3) && pop3 && pop3.started?
    pop3.reset # This clears all "deleted" marks from messages.
    pop3.finish
  end
end