Reading mail

Compared to sending mail, reading mail is a little more difficult. The main reason for this is because the syntax is a little weird at first, so you may need to keep referring back here. Note that the functionality shown here is designed for IMAP servers, but also works fine with POP3 and NNTP.

Author's Note: Although making your own applications is fun, don't be afraid to re-use what's already out there. For example, there's an excellent web mail package already available - check out SquirrelMail at


Want to learn PHP 7?

Hacking with PHP has been fully updated for PHP 7, and is now available as a downloadable PDF. Get over 1200 pages of hands-on PHP learning today!

If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!

Next chapter: Opening a mailbox >>

Previous chapter: Sending attachments (at last!)

Jump to:


Home: Table of Contents

Copyright ©2015 Paul Hudson. Follow me: @twostraws.