class.phpmailer.php SMTP -> ERROR: Failed to connect to server - php

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.

Related

I am having this error issue when I try to reset the password using laravel jetstream

Connection could not be established with host smtp.mailtrap.io :stream_socket_client(): Unable to connect to tcp://smtp.mailtrap.io:2525 (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)" this is the error message that is displayed
It’s related to your environment file .env and the email setup. Its going to need to be debugged as to what the email setting should be and then if they emails are even getting out from your server/localhost.

Server return error Unable to connect SMTP server when use ssl

Hi guis I have been migrating an application to new server, is an Ubuntu server but on the new server I have some problem to send emails using Cakephp 2.0.
If the host on cake mail config is localhost I have the following error:
SMTP Error: 530 5.7.0 Must issue a STARTTLS command first
Search on the internet the solutions may be is config SMTP ssl://mydomain.com.br on php.ini or using ssl host like this ssl://mydomain.com.br on cake mail config. On the first option nothing change, error persist and with host ssl on cake mail config I have the following error:
Unable to connect to SMTP server.
I make a simples test using only php mail() function and the email is been sent.
On this server I config postfix and dovecot may be this can be the problem?
you can use 'PHPMailer'.
it's simple and easy.
https://github.com/PHPMailer/PHPMailer

Couldn't open socket connection to server

I'm getting the following error message in a php-file when trying to connect to a third party server.
HTTP Error: Couldn't open socket connection to server http:// xxxxxxxx prior to connect(). This is often a problem looking up the
host name.
I know that the address is correct. What is the most common problem with this error? Could it be that the server only accept certain IP's to connect?

fsckopen() timeout when connecting to SMTP

We use a PHP library that opens a connection to SMTP server to validate certain emails when registering new clients.
After a server change the script has started reporting constant connection timeouts:
fsockopen(): unable to connect to alt1.gmail-smtp-in.l.google.com:25
(Connection timed out) in /home/xxxxxx.php on line 195, referer: xxxxx
We can telnet the server via console as root, but not as apache user so we discarded it to be an iptables firewall issue (we use CSF).
Strange enough, it seems we can fsckopen other pòrts.
We are digging other issues of CSF configuration but so far we are completely lost as no other logs (lfd, iptables, syslog) reports anything.
SOLVED!
If CSF option SMTP_BLOCK is activated (=1) apache user ("www-data" in our case), needs to be added to the SMTP_ALLOWUSER directive for PHP (through Apache) to work with SMTP as a destination.
CSF firewall will block any outgoing connections to SMTP for users not allowed but without any logging to lfd.log

My SQL Error: A connection attempt failed because the connected party did not properly respond

I have a MySQL database in a 3rd party server. I am trying to access it from my local machine using PHP in Dreamweaver. However, I am getting the following error:
MySQL Error #2002:
A connection attempt failed because the connected party did not properly respond
after a period of time, or established connection failed because connected host
failed to respond.
Thank you.
It means you can't connect to the server. Check your connecting to the correct IP address and your firewall is configured to allow traffic.
If your using "localhost" also try host name as 127.0.0.1. If its server try from mysql terminal whether that host is connecting from your local machine.
In local machine I have faced same issue with host localhost and changed to 127.0.0.1 then its works well.

Categories