Hi, So I setup exactly as in this tutorial https://soulstudio.info/blog/wordpress-smtp-setup-tutorial/ but when I try to send test email full Error Log for debugging shows this: Code: Versions: WordPress: 5.3.2 WordPress MS: No PHP: 7.3.11-1~deb10u1 WP Mail SMTP: 1.8.1 Params: Mailer: smtp Constants: No ErrorInfo: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Host: server1.mydomain.us Port: 465 SMTPSecure: ssl SMTPAutoTLS: bool(true) SMTPAuth: bool(true) Server: OpenSSL: OpenSSL 1.1.1d 10 Sep 2019 SMTP Debug: 2020-02-11 17:28:31 Connection: opening to ssl://server1.mydomain.us:465, timeout=300, options=array () 2020-02-11 17:30:43 Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://server1.mydomain.us:465 (Connection timed out) [/var/www/clients/client1/web1/web/wp-includes/class-smtp.php line 298] 2020-02-11 17:30:43 SMTP ERROR: Failed to connect to server: Connection timed out (110) SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Is this on an ISPConfig system? I ask because when I have installed Wordpress, I have done nothing extra and Wordpress has been able to send e-mail. Does the e-mail server work, that is it can send and receive e-mails? Is the above statement true? You have verified twice you really really have done exactly as written there?
Yes Yes, I can send and recieve emails using roundcude. Yes. If I turn off that plugin and try to send email using contact form it goes through. It does not work when I enable the plugin?
Try using port 587 instead of 465 if you want to use phpmailer. And you probably need a valid ssl cert for the mail system incl chain cert install in case you have not done that yet. Another option that is probably easier to setup is that you use smtp server: localhost, port: 25 plus the email address and password of a local smtp account.
Just tried 587 and after sometime trying to send test email it gives me pretty much same error. What is preventing it connect on either of those ports? Can you please point me in the right direction on how to install valid ssl cert for the mail system incl chain cert install? I'm using "The Perfect Server - Debian 10 (Buster)" VMWare image. Here's port 25 error: Code: Versions: WordPress: 5.3.2 WordPress MS: No PHP: 7.3.11-1~deb10u1 WP Mail SMTP: 1.8.1 Params: Mailer: smtp Constants: No ErrorInfo: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Host: server1.mydomain.us Port: 25 SMTPSecure: string(0) "" SMTPAutoTLS: bool(true) SMTPAuth: bool(true) Server: OpenSSL: OpenSSL 1.1.1d 10 Sep 2019 SMTP Debug: 2020-02-11 18:54:37 Connection: opening to server1.mydomain.us:25, timeout=300, options=array () 2020-02-11 18:56:48 Connection failed. Error #2: stream_socket_client(): unable to connect to server1.mydomain.us:25 (Connection timed out) [/var/www/clients/client1/web1/web/wp-includes/class-smtp.php line 298] 2020-02-11 18:56:48 SMTP ERROR: Failed to connect to server: Connection timed out (110) SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Most likely the ssl cert of the mail system or the ssl client lib of the used php version is not compatible with the tls version that the mail system is using.
Ok, so I updated: /etc/postfix/smtpd.cert /etc/postfix/smtpd.key with current valid wildcard ssl info. Same ssl is used for ISPconfig. Rebooted server and I'm still getting same time out error. The system is on php v7.3 Any other suggestions? Is it pretty common not to be able to use any plugins to connect to the mail server on the ISPconfig?
Ok, but did you install the SSL chain certs as well in postfix? without chain certs, PHP is probably not able to verify the SSL cert and therefore it fails to connect. Your problem is not ispconfig specific, ispconfig is not involved in this process at all. Its a connection between PHP and postfix that fails.
I did try all of them: /etc/letsencrypt/live/www.mydomain.us/privkey.pem > /etc/postfix/smtpd.key /etc/letsencrypt/live/www.mydomain.us/chain.pem > /etc/postfix/smtpd.cert and /etc/letsencrypt/live/www.mydomain.us/fullchain.pem > /etc/postfix/smtpd.cert Rebooted server after each change but getting same timeout. I did telnet test and got this: Code: [root@server1 ~]# telnet server1.mydomain.us 465 telnet: Unable to connect to remote host: Connection timed out Trying 192.168.0.100... [root@server1 ~]# Its trying to connect to 192.168.0.100 which is part of VMWare image setup and is not part of my server network. Where can I change that to server1.mydomain.us real IP?
The chain file is configured like this: smtpd_tls_CAfile = /etc/letsencrypt/live/www.mydomain.us/chain.pem then restart postfix. And you shall use port 587 and not 465. Port 587 is the submission port which is typically used to send email with TLS. /etc/hosts
After changing /etc/hosts it is able to connect to the mail server now but gives slightly different error: Code: Versions: WordPress: 5.3.2 WordPress MS: No PHP: 7.3.11-1~deb10u1 WP Mail SMTP: 1.8.1 Params: Mailer: smtp Constants: No ErrorInfo: SMTP Error: Could not connect to SMTP host. Host: server1.mydomain.us Port: 587 SMTPSecure: tls SMTPAutoTLS: bool(true) SMTPAuth: bool(true) Server: OpenSSL: OpenSSL 1.1.1d 10 Sep 2019 SMTP Debug: 2020-02-12 19:35:02 Connection: opening to server1.mydomain.us:587, timeout=300, options=array () 2020-02-12 19:35:02 Connection: opened 2020-02-12 19:35:02 SERVER -> CLIENT: 220 server1.mydomain.us ESMTP Postfix (Debian/GNU) 2020-02-12 19:35:02 CLIENT -> SERVER: EHLO www.mydomain.com 2020-02-12 19:35:02 SERVER -> CLIENT: 250-server1.mydomain.us250-PIPELINING250-SIZE250-VRFY250-ETRN250-STARTTLS250-ENHANCEDSTATUSCODES250-8BITMIME250-DSN250-SMTPUTF8250 CHUNKING 2020-02-12 19:35:02 CLIENT -> SERVER: STARTTLS 2020-02-12 19:35:02 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS 2020-02-12 19:35:02 Connection failed. Error #2: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed [/var/www/clients/client1/web1/web/wp-includes/class-smtp.php line 374] SMTP Error: Could not connect to SMTP host. 2020-02-12 19:35:02 CLIENT -> SERVER: QUIT 2020-02-12 19:35:02 2020-02-12 19:35:02 2020-02-12 19:35:02 Connection: closed SMTP Error: Could not connect to SMTP host. I was manually entering info in /etc/postfix/smtpd.key and /etc/postfix/smtpd.cert Are you saying I should enter smtpd_tls_CAfile = /etc/letsencrypt/live/www.mydomain.us/chain.pem in /etc/postfix/main.cf ? what about: smtpd_tls_cert_file=/etc/letsencrypt/live/www.mydomain.us/fullchain.pem smtpd_tls_key_file=/etc/letsencrypt/live/www.mydomain.us/privkey.pem Anything else needs to be enabled in /etc/postfix/main.cf?
Ok, I think I got it to work. I added: smtpd_tls_cert_file=/etc/letsencrypt/live/www.mydomain.com/fullchain.pem smtpd_tls_key_file=/etc/letsencrypt/live/www.mydomain.com/privkey.pem smtpd_tls_CAfile=/etc/letsencrypt/live/www.mydomain.com/chain.pem instead of: # TLS parameters smtpd_tls_cert_file = /etc/postfix/smtpd.cert smtpd_tls_key_file = /etc/postfix/smtpd.key inside /etc/postfix/main.cf rebooted server and I was able to send test email! Obviously www.mydomain.com is domain hosted on my server server1.mydomain.us Do I need to add anything else to /etc/postfix/main.cf other than above? I found above in this post so I'm not sure if that's all what is needed.