PHP code example of geerlingguy / imap

1. Go to this page and download the library: Download geerlingguy/imap library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

geerlingguy / imap example snippets


$host = 'imap.example.com';
$user = 'johndoe';
$pass = '12345';
$port = 993;
$ssl = true;
$folder = 'INBOX';
$mailbox = new Imap($host, $user, $pass, $port, $ssl, $folder);

$mailbox->getMailboxInfo();

$mailbox->getCurrentMailboxInfo();

$mailbox->getMessageIds();

$id = 2;
$mailbox->getMessage($id);

$id = 2;
$mailbox->deleteMessage($id);

$mailbox->disconnect();