note 82466 deleted from function.imap-open by cmb
| From: | cmb@php.net | Date: | Sun, 18 Aug 2019 08:38:31 +0000 |
| Subject: | note 82466 deleted from function.imap-open by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211928@lists.php.net to get a copy of this message | ||
Note Submitter: Binit
----
I was trying imap_open() function but I was continuously getting this error:
Array ( [0] => [CLOSED] IMAP connection broken (server response) )
I was finally able to solve this problem (which is a very common problem as I saw it on the net but
could not find any solution to it) so I'm posting my solution here which I hope will be useful
to others.
I used stunnel program (http://www.stunnel.org/) and made changes in the stunnel.conf file as
follows:
I added these lines:
[imapsClient]
accept = localhost:143
connect = imapserver:993
client = yes
sslVersion = TLSv1
This will map insecure imap connection from localhost:143 to imapserver:993 (IMAP with SSL).
After this I tried this code and it worked fine:
<?php
$user="";
$pass="";
$imap = @imap_open("{localhost:143}INBOX", $user, $pass);
?>
and I was able to do away with the errors.
A more detailed post about it can be found here:
http://www.phpfreaks.com/forums/index.php/topic,190628.0.html