Not to able to deliver emails using external SMTP

Remmsi

Verified User
Joined
May 18, 2024
Messages
13
Hi @Richard G ,

I have another instance using VestaCP for Email delivery using external SMTP which is working well there but since I configured new server with Direct Admin now I am facing challenges to email delivery, getting error:

Connection could not be established with host hostname.com :stream_socket_client(): Unable to connect to hostname.com and port (Connection refused)

I tried exim rebuild, CSF update but same problem. Can you please help
 
As you know we do not support VestaCP here, only Directadmin.

I can't fix any issues without more information, so I need at least a real domain name.
If you don't want to place that in public for whatever reason, then send me the domain name in pm.

Also it would be good to know when you get that error.
Does DA give that error notice of connection refused? And if yes, when exactly, to where are you trying to send mail.
 
you need to set "CSF=no" in custombuild for prevent any DA Update rewrite csf firewall config.

then set "SMTP_BLOCK=0" in csf firewall and restart service to make change config.
 
Last edited:
Thanks @Ohm J It's working If I am disabling CSF. but not after changing SMTP_BLOCK=0 and restart CSF

@Richard G Now we know It's CSF issue. I have to make necessary changes on it. It will be really helpful if I can get best guidance for it
 
Now we know It's CSF issue.
Unless you changed things. Normally everything is setup correctly by default in CSF.
Check your pm, there is another thing still not correct, however, most likely not causing this issue.

Often people like also their web applications to make use of php mail.

I always have this in the CSF.conf file.
SMTP_BLOCK=1
SMTP_ALLOWLOCAL = "1"
SMTP_REDIRECT = "0"
SMTP_PORTS = "25,465,587"
SMTP_ALLOWUSER = ""
SMTP_ALLOWGROUP = "mail,mailman"
SMTPAUTH_RESTRICT = "0"

which is quite default and -always- works on all of my servers. I would suggest to set it the same and restart csf and lfd.
csf -ra

Then as suggested in pm, first try via e-mail client and via Roundcube. If that is working then CSF is setup fine and the issue is caused by the webmail thing you're trying to use.
 
@Richard G
He want to use external SMTP service like gmail, hotmail ..etc.. , set "SMTP_BLOCK=0" should be fine unless there have something else cause issued.
 
He want to use external SMTP service like gmail,
No he doesn't specifically. He's trying to mail to his DA and from his DA server. I talked to him via pm.

And smtp_block=0 can be used but 1 is more secure i.c.m. with the smtp_allowlocal setting.
As you could read in post #4, setting smtp_block to 0 did not fix it either.
 
Hi, Sometimes solution is so easy but we are looking towards it. I just allowed that IP address to make connection in CSF and now everything working.
We are an ESP and we configured our own MTA setup to provide services to client. With DA server I just hosted our Application but mails will go through external MTA server. Yes I use sendgrid/Sparkpost and others as well because we are reseller of it.

Thank you all for your support :)
 
Back
Top