PHP imap_open() error – INBOX: invalid remote specification (errflg=2)

Read Time:37 Second

INBOX: invalid remote specification (errflg=2)


Got following error when use imap_open() in PHP?


Notice: Unknown: Can't open mailbox {}INBOX: invalid remote specification (errflg=2) in Unknown on line 0


Check imap enabled SSL support like screenshot



If cannot see SSL Support configuration, then need re-compile with enabling SSL support.



PHP IMAP connection test code

    ini_set('display_errors', 1);

    $imap_path = "{}INBOX";
    $email_address = "email address";
    $email_password = "password";

    $mbox = imap_open ($imap_path, $email_address, $email_password);

    if($mbox === false) {
        echo "Connection failed";
    } else {
        echo "Connected";


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.