IMAP class for reading IMAP emails with PHP

Example usage:

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    = '';
$password = 'emailpassword';
$host     = '';//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);

© 2006 - 2023 DC Blog. All code MIT license. All rights reserved.