Revenant
Revenant

Reputation: 2984

Reading POP3 emails with PHP and IMAP issues

Problem


I want to connect to my mail box on my domain name. Unfortunately I couldn't succeed so far.

/* mail information */
$hostname   = '{mail.domain.com:110/pop3}INBOX';
$user       = '[email protected]';
$pass       = 'mypassword';

/* try to connect */
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Mail: ' . imap_last_error());

Error Output

Cannot connect to Mail: Certificate failure for mail.domain.com: Self-signed certificate or untrusted authority: C=US, S=Someprovince, L=Sometown, O=none, OU=none, CN=localhost, E=webaster@localhost

I also tried following;

1. approach

$hostname = '{mail.domain.com:110}INBOX';

After quite long time of waiting;

Cannot connect to Mail: [CLOSED] IMAP connection broken (server response)

2. approach

$hostname   = '{mail.domain.com:110/pop3/novalidate-cert}INBOX';

Almost immediate response;

Cannot connect to Mail: Login aborted

At this point, I tried what I could find on PHP.net, Google and SOF without any success.

What could be the problem and what could be the solution? I don't think imap connection is hard to connect.

Upvotes: 1

Views: 5206

Answers (2)

Gigi
Gigi

Reputation: 29421

Well I've never used IMAP and POP in PHP, but it's evident to me that you're trying to connect via IMAP on a POP3 port. IMAP listens on port 143.

Upvotes: 1

belgther
belgther

Reputation: 2534

You can use /novalidate-cert in hostname parameter to bypass certificate validations in case you use self-signed certificates. See http://php.net/manual/de/function.imap-open.php for further information.

Upvotes: 2

Related Questions