Best way to block outgoing port 25

osnanderson

Member
Jan 8, 2023
14
1
3
Brasil
cPanel Access Level
Root Administrator
Hello

Can you tell me the best way to block the outgoing port 25 completely on the server?

I tried removing the outgoing IPV4 port from the CSF firewall configuration, but still emails are being sent from cPanel. I wanted to completely block port 25 so no emails are sent from the server.

Would you know how to help me?

Thank you
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
15,261
2,431
363
cPanel Access Level
Root Administrator
Hey there! If you don't want any email sent, you could just disable Exim so it isn't running. Inside CSF there is also this option:

Code:
# 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"
so you'll want to remove the ports you don't want active in the firewall from that list.
 

osnanderson

Member
Jan 8, 2023
14
1
3
Brasil
cPanel Access Level
Root Administrator
I'll explain my situation better:

I want to completely block outgoing emails through port 25, but allow sending emails to some accounts via smarthost on another port. So I believe disabling exim would not work.

Do you know how to do this total blocking of outgoing port 25?
 

quietFinn

Well-Known Member
Feb 4, 2006
1,895
464
438
Finland
cPanel Access Level
Root Administrator
I believe you also need SMTP_BLOCK = ON in CSF.