0
votes

Here is my laravel code:

function checkUser(User $user) {

    $mbox = imap_open("{imap.gmail.com:993/imap/ssl/novalidate-cert}", $user->email, $user->password, OP_HALFOPEN);

    if ($mbox)
        return true;
    else
        return false;
}

Error:

imap_open(): Couldn't open stream {imap.gmail.com:993/imap/ssl/novalidate-cert

2

2 Answers

0
votes

Have you enable settings in Gmail. You have to enable access to less secure app from settings.

https://devanswers.co/allow-less-secure-apps-access-gmail-account/

Also try enabling your php_imap extension php.ini file.

Try this line

 $mbox = imap_open("{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX", $user->email, $user->password, OP_HALFOPEN);
0
votes

In the end he solved the problem by putting an "@" in front of the function.

CODE:

$mbox = @imap_open("{imap.gmail.com:993/imap/ssl/novalidate-cert}", $user->email, $user->password, OP_HALFOPEN);