Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Retrieve messages from an IMAP server (get messages from gmail inbox)

Notifications You must be signed in to change notification settings

kirilkirkov/PHP-IMAP-Messages-Fetcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

PHP IMAP

Retrieve messages from an IMAP server

Usage example:

$imap = new Imap();
$connection_result = $imap->connect('{imap.gmail.com:993/imap/ssl}INBOX', '[email protected]', 'password');
    if ($connection_result !== true) {
        echo $connection_result; //Error message!
        exit;
    }
$messages = $imap->setLimit(10)->getMessages('text', 'asc'); // Return array of messages. Second parameter is for type of sort desc|asc

in $attachments_dir property set directory for attachments

in the __destructor set errors log file

If you use gmail must allow - https://support.google.com/accounts/answer/6010255?hl=en

Dependencies

php-imap
Installations:
MacOS: brew install kabel/php-ext/[email protected] (php 7.2 in this example)
Ubuntu: sudo apt install php7.2-imap

Donate

If this project help you reduce time to develop, you can give me a cup of coffee to continue its development. Thank you! :) Donate