Solve PHP imap_open Invalid Certificate Failure

Lets say, I have a following configuration:

Incoming Server: mail.domain.com
IMAP Port: 143
Username: user@domain.com
Password: userpass

But having error while trying to connect inbox, like following code:

$inbox = imap_open('{mail.domain.com:143}INBOX', 'user@domain.com', 'userpass');

ERROR:
Can't open mailbox {mail.domain.com:143}INBOX: invalid remote specification

The solution is to use a flag “/novalidate-cert”. Its purpose is “do not validate certificates from TLS/SSL server, needed if server uses self-signed certificates”.

So this will be right call:

$inbox = imap_open('{mail.domain.com:143/novalidate-cert}INBOX', 'user@domain.com', 'userpass');
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s