Now, let's deal with the part of receiving mails.
In this recipe we will be giving examples on the different methods of connecting to mailbox through ZF2, and therefore it would be nice if we had access to a mailbox we connect to. Of course this is not required, but it sure adds to the fun to have an actual working mailbox.
We will now discuss receiving e-mail within an application, which can be useful on some occasions.
The first method of connecting to a mail server is through IMAP. The protocol basically lets us connect to the mail server, and looking in the different folders on the server if there are unread e-mails.
Let's take a look at our example:
<?php // Usually this ...