tonybikini
New member
- Joined
- Sep 5, 2024
- Messages
- 5
Hello guys,
I need help to set-up my clients websites to be able to send outgoing emails from their websites as i don't find the needed information online. It seems it should be an easy fix, but i am doing something wrong somewhere.
Each wordpress instance under each directadmin clients virtual hosts, has a contact form that should be sending mail to the clients emails, through smtp. The mail servers work properly, and are hosted through mxroute email servers which are remote and separate to my main domain servers. They used to work and run properly on multiple plesk servers, but I just migrated to a new server under directadmin with debian 12 for a better VPS and easier management at a lower cost. Everything is set-up fine, except for emails.
My issue rises inside my directadmin main domain servers which seem to block outgoing smtp connections. I have CSF turned on. here's what inside the etc/csf/csf.conf:
Concerning smtp:
Which seem to be the correct ports and config as i've searched elsewhere on these forums and internet. MXroute email service uses ports 465 for ssl and 587 for TCL.
However, inside my wp forms smtp plugin ( WP Mail SMTP ), i am not able to send outgoing mail to my webmail servers on mxroute on either ssl or tcl. i keep having these error logs:
I have a smtp code: 111 issue showing up with connection refused. It says it's a stream socket client issue at line 408 under my wordpress website smtp.php file.
here's the content of line 408 about stream_socket_client, which seem fine:
It seems to me that it would be some issue inside directadmin that doesn't allow the outgoing connection, or some wordpress config which would interrupt the connection as it wouldn't find the host. But i never had to fiddle in the wp config files and they used to work on the previous servers, so i don't think i would have to edit this. Correct me if i'm wrong, but I really think it has something to do with directadmin configuration.
Otherwise, i've seen some information about updating the /etc/exim.conf file of the root server. I've checked through it and it seems there is indeed some smtp configuration going on, but not sure about how i would go about setting-up that file for multiple domains and different users under different domains securely, so they're properly set-up.
Any help on this will be appreciated! Hopefully I can get my forms and outgoing emails working again this weekend.
Cheers
I need help to set-up my clients websites to be able to send outgoing emails from their websites as i don't find the needed information online. It seems it should be an easy fix, but i am doing something wrong somewhere.
Each wordpress instance under each directadmin clients virtual hosts, has a contact form that should be sending mail to the clients emails, through smtp. The mail servers work properly, and are hosted through mxroute email servers which are remote and separate to my main domain servers. They used to work and run properly on multiple plesk servers, but I just migrated to a new server under directadmin with debian 12 for a better VPS and easier management at a lower cost. Everything is set-up fine, except for emails.
My issue rises inside my directadmin main domain servers which seem to block outgoing smtp connections. I have CSF turned on. here's what inside the etc/csf/csf.conf:
# Allow incoming TCP ports
TCP_IN = "35000:35999,20,21,22,25,53,853,80,110,143,443,465,587,993,995,2222"
# Allow outgoing TCP ports
TCP_OUT = "143,20,21,22,25,53,853,80,110,113,443,465,587,993,995,2222"
Concerning smtp:
SMTP_BLOCK = "1"
# If SMTP_BLOCK is enabled but you want to allow local connections to port 25
# on the server (e.g. for webmail or web scripts) then enable this option to
# allow outgoing SMTP connections to the loopback device
SMTP_ALLOWLOCAL = "1"
# This option redirects outgoing SMTP connections destined for remote servers
# for non-bypass users to the local SMTP server to force local relaying of
# email. Such email may require authentication (SMTP AUTH)
SMTP_REDIRECT = "0"
# This is a comma separated list of the ports to block. You should list all
# ports that exim is configured to listen on
SMTP_PORTS = "25,465,587"
Which seem to be the correct ports and config as i've searched elsewhere on these forums and internet. MXroute email service uses ports 465 for ssl and 587 for TCL.
However, inside my wp forms smtp plugin ( WP Mail SMTP ), i am not able to send outgoing mail to my webmail servers on mxroute on either ssl or tcl. i keep having these error logs:
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: 111 Additional SMTP info: Connection refused
Host: ******.******.*** // (hidden here for security purposes, the host does show up correctly in my actual file)
Port: 465
SMTPSecure: ssl
SMTPAutoTLS: bool(true)
SMTPAuth: bool(true)
Server:
OpenSSL: OpenSSL 3.0.14 4 Jun 2024
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: 111 Additional SMTP info: Connection refused
SMTP Debug:
2024-09-05 19:55:35 Connection: opening to ssl://****.****.***:465, timeout=30, options=array()
2024-09-05 19:55:35 Connection failed. Error #2: stream_socket_client(): Unable to connect to ssl://****.****.***:465 (Connection refused) [/home/user/domains/userdomain.com/public_html/wp-includes/PHPMailer/SMTP.php line 408]
2024-09-05 19:55:35 SMTP ERROR: Failed to connect to server: Connection refused (111)
SMTP Error: Could not connect to SMTP host. Failed to connect to server
I have a smtp code: 111 issue showing up with connection refused. It says it's a stream socket client issue at line 408 under my wordpress website smtp.php file.
here's the content of line 408 about stream_socket_client, which seem fine:
$connection = stream_socket_client(
$host . ':' . $port,
$errno,
$errstr,
$timeout,
STREAM_CLIENT_CONNECT,
$socket_context
);
It seems to me that it would be some issue inside directadmin that doesn't allow the outgoing connection, or some wordpress config which would interrupt the connection as it wouldn't find the host. But i never had to fiddle in the wp config files and they used to work on the previous servers, so i don't think i would have to edit this. Correct me if i'm wrong, but I really think it has something to do with directadmin configuration.
Otherwise, i've seen some information about updating the /etc/exim.conf file of the root server. I've checked through it and it seems there is indeed some smtp configuration going on, but not sure about how i would go about setting-up that file for multiple domains and different users under different domains securely, so they're properly set-up.
Any help on this will be appreciated! Hopefully I can get my forms and outgoing emails working again this weekend.
Cheers