PHP code example of javanile / php-imap2

1. Go to this page and download the library: Download javanile/php-imap2 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/ */

    

javanile / php-imap2 example snippets




$mbh = imap2_open(
    $server,
    $username,
    $token,
    OP_XOAUTH2
);

if (! $mbh) {
    error_log(imap2_last_error());

    throw new RuntimeException(
        'Unable to open the INBOX'
    );
}

$error = imap2_last_error();

if ($error) {
    echo $error;
}
bash
composer