I use the PHP function imap_open to connect to a localhost dovecot server. It works most of the time, but sometimes I have warning:
PHP Warning: imap_open(): Couldn't open stream
{imap.fluoo.com/imap:993/ssl/novalidate-cert}INBOX Can not
authenticate to IMAP server: [CLOSED] IMAP connection broken
(authenticate)
When this occur I have in mail log:
Sep 3 10:38:01 bipbip dovecot: imap(robot.info#XXXXXXX.com)<3325276><ovIENBPLAsV/AAAB>: Connection closed (No commands sent) in=0 out=394 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
I haven't this error for distant connexion with Thunderbird or Outlook, only for PHP in localhost.
I have read that the issue is due to SSL but I don't want to disable it.
I use PHP 7.4.22 and dovecot 2.3.7.2.
If you can help me because I want to try to avoid use # operator to delete warning...
Related
We have a php script to handle bounce mails. Now I have to take care of switching from the PEAR NET/POP3 library to the native-ish php-imap library.
The mailserver listens on a remote server on port 110 without ssl (obviously POP3).
However I am unable to open a connection to that server using the php-imap library using the following code:
imap_open("{example.com:110/pop3/notls}INBOX", $username, $password);
This results in the following errors:
Warning: imap_open(): Couldn't open stream {example.com:110/pop3/notls}INBOX in C:\xampp\htdocs\bounce-processing\info.php on line 1
Notice: Unknown: POP3 connection broken in response (errflg=2) in Unknown on line 0
The following PEAR POP3 implementation still works:
require("Net/POP3.php");
$pop3 = new Net_POP3();
$pop3->connect('example.com', 110)
$pop3->login($username, $password);
What I already tried:
imap_open("{IP-ADDRESS:110/pop3/notls}INBOX", $username, $password);
imap_open("{IP-ADDRESS:110/pop3/notls/user=$username}INBOX", $username, $password);
NOTE: I also tested this on different setups (CentOS / Apache 2.2, Ubuntu 14.04 / nginx, PHP 5.4, PHP 5.5, PHP 5.6, no different outcome.
What can I do? Debugging did not really help me - and that the pear class works freaks me out.
Thanks in advance!
EDIT: php binary is compiled with imap / ssl and the php-imap extension is enabled in the php.ini. If you know another future-proof way to make php talk to a pop3 mailserver, let me know. We don't want to use frameworks such as phpmailer etc.
EDIT2: telnet login works with a success rate of 40%. I was able to successfully log in 4 out of 10 times with correct credentials.
Output of the CAPA command:
CAPA
+OK Here's what I can do:
STLS
TOP
USER
LOGIN-DELAY 10
PIPELINING
UIDL
IMPLEMENTATION Courier Mail Server
.
I don't know if thats important, but the mailserver is in fact hosted by a dedicated server housing and hosting company.
EDIT3: Trying to connect via
{IP_ADDRESS:110/pop3}
returns the following errors:
Warning: imap_open(): Couldn't open stream {IP_ADDRESS:110/pop3} in C:\xampp\htdocs\bounce-processing\index.php on line 12
Notice: Unknown: Certificate failure for IP_ADDRESS: Server name does not match certificate.
Appending the flag novalidate-cert leads to a timeout.
I am having some issues with imap_open.
This is the error I am getting:
Message: imap_open(): Couldn't open stream
{imap-mail.outlook.com:993/imap/ssl/novalidate-cert}INBOX
No matter if its imap using ssl on port 993 or pop ssl on port 995, I am getting the same error.
Message:
Unknown: Can't open mailbox
{imap-mail.outlook.com:993/imap/ssl/novalidate-cert}INBOX: invalid
remote specification (errflg=2)
I have the following setup:
Mac OSX Yosemite
Mamp Pro running PHP 5.6.10
Here is what I've done to troubleshoot:
I have apple mail setup to check my gmail account using imap ssl on port 993. I will assume if apple mail can retrieve mail, the port is open.
I went to Security and Privacy and did a PORT SCAN... 993 and 995 were not open... strange.
I do not have Mac Firewall enabled.
When using non ssl, on port 110 pop, this appears to be working fine.
Can anyone assist to see what may be the cause.
Check phpinfo() to see if php is complied --with-imap-ssl
http://www.bartvanasselt.nl/mamp-pro-using-imap-with-ssl/
Also can try tunneling:
Workaround for PHP IMAP functions? Trying to work with incoming email on localhost using XAMPP
I've been using class.phpmailer.php for some time but recently it stop working on my web server.
It is still working on my home computer but I guess that it's because I didn't update xampp.
The error returned is:
php SMTP -> ERROR: Failed to connect to server: A connection attempt
failed because the connected party did not properly respond after a
period of time, or established connection failed because connected
host has failed to respond. (10060)
I've also used this class eukhost and it sends the email with no errors.
I'm now going debugging class.phpmailer.php to see what is wrong.
But before I start, I would like to know if someone got this problem ans solved it.
If this had been working and now has recently stopped, it could be a temporary issue, or some settings for the mail server have been changed and you now need to update your settings.
The error message is telling you that it could not connect to the mail server. Socket error 10060 is a general operation timed out message.
You need to verify that the SMTP host and port numbers being used by phpmailer are correct. You should from another machine (or the same system running PHP) be able to telnet your-mail-server-here.com 25 where 25 represents the port number.
If you can't connect to the server, then the mail server is down or the hostname or port have changed. If you can connect from other systems but not from your PHP server, it is possible your IP has been blocked from the mail server, or a local/remote firewall are preventing your connection.
Hope that helps.
I'm getting an error:
Warning: imap_open() [function.imap-open]: Couldn't open stream {pop3.live.com:995/pop3/ssl/novalidate-cert}INBOX in /home/.../imap.php on line 3
when using code:
$mbox = imap_open('{pop3.live.com:995/pop3/ssl/novalidate-cert}INBOX', '<user>', '<pass>');
Your URL has pop3 for a sub-domain. Are you sure that IMAP is available (ports 143 or 993 open)?
Doing a quick search, it looks like imap has to be enabled on your live.com account. Are you able to IMAP to the server using a standard mail client, like Thunderbird?
Also, you are pointing to pop3.live.com on port 995, which is a POP3 port, not an IMAP port.
In my case it was {domain:110/pop3/novalidate-cert}INBOX that helped me in fixing both the CLOSED IMAP connection broken (server response) and Certificate failure for domain.
Confirm your ports and also whether you have ssl enabled using
openssl s_client -crlf -connect your-domain-name:port-number
My project uses PHP JavaBridge, I have installed WAMP, JRE 6.0, and Tomcat 6.0.32
I can now access http://localhost:8080/ successfully but when I run my PHP site it gives me the following error
warning: fsockopen() [function.fsockopen]: unable to connect to localhost:8080 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. )
Can anyone please help me with this issue?
EDIT
Forgot to mention that I am using Windows 7
My comment above worked as a solution and hence this answer, so that in future others get it.
Can you 127.0.0.1:8080 instead of localhost:8080? See what do you get?
fsocketopen takes the hostname and it should be a valid domain, in your case, (in general) it could be a valid domain as long as you have an entry for localhost in your hosts file (C:\Windows\System 32\drivers\etc\hosts). See if you have something similar to that.