Could not connect to SMTP host

Hello,
I am creating my blog posts using projectdmc.org and the generatepress theme and I want to be able to send emails in WordPress using the WP SMTP Mail plugin. I followed all the steps given but am facing this error:
SMTP Error: Could not connect to SMTP host. Failed to connect tot serverSMTP server error: Failed to connect to server Additional SMTP info: php_network_getaddresses: getadrinfo for Fastmail failed: Name or service not known:

Versions: WordPress: 6.5 WordPress MS: No PHP: 8.2.17 WP Mail SMTP: 4.0.1 Params: Mailer: smtp Constants: No ErrorInfo: SMTP Error: Could not connect to SMTP host. Failed to connect to serverSMTP server error: Failed to connect to server SMTP code: 110 Additional SMTP info: Connection timed out Host: smtp.fastmail.com Port: 465 SMTPSecure: ssl SMTPAutoTLS: bool(true) SMTPAuth: bool(true) Server: OpenSSL: OpenSSL 3.0.11 19 Sep 2023 Apache.mod_security: No Debug: Email Source: WP Mail SMTP Mailer: Other SMTP SMTP Error: Could not connect to SMTP host. Failed to connect to serverSMTP server error: Failed to connect to server SMTP code: 110 Additional SMTP info: Connection timed out SMTP Debug: 2024-04-03 11:46:18 Connection: opening to ssl://smtp.fastmail.com:465, timeout=300, options=array() 2024-04-03 11:50:41 Connection failed. Error #2: stream_socket_client(): Unable to connect to ssl://smtp.fastmail.com:465 (Connection timed out) [/var/www/html/wp-includes/PHPMailer/SMTP.php line 408] 2024-04-03 11:50:41 SMTP ERROR: Failed to connect to server: Connection timed out (110) SMTP Error: Could not connect to SMTP host. Failed to connect to server

We changed the port from 587 and SMTPSecure: tls to 465 and SMTPSecure: SSL but we got the above error

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer