Introduction to Net_POP3

Introduction to Net_POP3

About Net_POP3

Provides a POP3 class to access POP3 servers. Supports all POP3 commands including UIDL listings and APOP authentication.

Usage of this class compared to native PHP extensions such as IMAP is slow and may be feature deficient. If available you are STRONGLY recommended to use the PHP extensions.

Usage example for Net_POP3

Usage

<?php
include 'Net/POP3.php';

$pop3 =& new Net_POP3();

/*
 * Connect to localhost on usual port
 * If not given, defaults are localhost:110
 */
$pop3->connect('localhost'110);

/*
 * Login using username/password. APOP will
 * be tried first if supported, then basic.
 */
$pop3->login('richard''Alien3');

/*
 * Get the raw headers of message 1
 */
echo '<h2>getRawHeaders()</h2>';
echo 
'<pre>' htmlspecialchars($pop3->getRawHeaders(1)) . '</pre>';

/*
 * Get structured headers of message 1
 */
echo '<h2>getParsedHeaders()</h2> <pre>';
print_r($pop3->getParsedHeaders(1));
echo 
'</pre>';

/*
 * Get body of message 1
 */
echo '<h2>getBody()</h2>';
echo 
'<pre>' htmlspecialchars($pop3->getBody(1)) . '</pre>';

/*
 * Get number of messages in maildrop
 */
echo '<h2>getNumMsg</h2>';
echo 
'<pre>' $pop3->numMsg() . '</pre>';

/*
 * Get entire message
 */
echo '<h2>getMsg()</h2>';
echo 
'<pre>' htmlspecialchars($pop3->getMsg(1)) . '</pre>';

/*
 * Get listing details of the maildrop
 */
echo '<h2>getListing()</h2>';
echo 
'<pre>';
print_r($pop3->getListing());
echo 
'</pre>';

/*
 * Get size of maildrop
 */
echo '<h2>getSize()</h2>';
echo 
'<pre>' $pop3->getSize() . '</pre>';

$pop3->disconnect();
?>
Net_POP3 (Previous) Constructor (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.