WordPress and Easy WP SMTP plugin failed to send mails.
In order to resolve the issue let's have check all the mail configurations and test mails via Easy WP SMTP. But I failed and found the error “Name or service not known (0)SMTP connect() failed”.
It means, for some reason PHP was not able to get the network addresses of the given domain name. To confirm that the issue is with PHP, so let write a small script as shown below:
?php $ip = gethostbyname('www.google.com'); echo $ip; ?
With the function gethostbyname, it will get the IPv4 address corresponding to the given hostname or prints back the hostname on failure.
Previously, the gethostbyname has failed to get the IP address of the given hostname and that was the culprit.
Now restart the php-fpm daemon and everything will work fine.