17.4.3. Discussion
The underlying library PHP uses to support IMAP and POP3 offers a
seemingly unending number of features that allow you to essentially
write an entire mail client. With all those features, however, comes
complexity. In fact, there are currently 63 different functions in
PHP beginning with the word imap, and that
doesn't take into account that some also speak POP3
and NNTP.
However, the basics of talking with a mail server are
straightforward. Like many features in PHP, you begin by opening the
connection and grabbing a handle:
$mail = imap_open('{mail.server.com:143}', 'username', 'password');