Name

Net::POP3 — POP3 connection class

Synopsis

Net::POP3 is a class for Post Office Protocol Version 3 (POP3) client-side connection. POP3 is a simple protocol that retrieves incoming mail from the server.

Required Library

require ‘net/pop’

Example

require 'net/pop'

pop = Net::POP3::new("pop.ruby-lang.org")
# authenticate just for SMTP before POP
pop.start("matz", "skwkgjv;") {
  mails = pop.mails          # array of Net::POPMail
}

Class Methods

Net::POP3::new([addr="localhost"[, port=80]])

Creates a new Net::POP3 object.

Net::POP3::start([addr="localhost"[, port=80[, ...]]])
Net::POP3::start([addr="localhost"[,port=80[,...]]]) {|pop|...}

Equivalent to Net::POP3::new(addr, port).start(...). A newly created Net::POP3 object is passed to the block, if specified. The POP3 session is terminated when the block exits.

Instance Methods

p.each {|mail|...}

Synonym for p.mails.each.

p.finish

Closes the POP3 session.

p.mails

Returns an array of Net::POPMail objects.

p.start(acct, passwd)
p.start(acct, passwd) {|pop|...}

Starts a POP3 session. If a block is specified, the session is terminated when the block exits.

Get Ruby in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.