IMAP class for reading IMAP emails with PHP
Using composer include the repository by typing the following into a terminal
composer require dcblogdev/imap
use Dcblogdev\Imap\Imap; //set search criteria $date = date('d-M-y', strtotime('1 day ago')); $term = 'ALL UNDELETED SINCE "'.$date.'"'; //ignore array of emails $exclude = ; $email = 'firstname.lastname@example.org'; $password = 'emailpassword'; $host = 'outlook.office365.com';//your email host $port = '993';//port number $savePath = "emails";//folder to save attachments $delete = false;//set to true to delete email //initialise email $imap = new Imap($email, $password, $host, $port, 'Inbox', $savePath, $delete); //get emails pass in the search term and exclude array $emails = $imap->emails($term, $exclude);
Help support the blog so that I can continue creating new content!
Subscribe and get my books and product announcements.