allow outgoing SMTP for single domain

herzla

Member
Apr 19, 2021
15
1
3
here
cPanel Access Level
Root Administrator
I prefer to have ' Restrict outgoing SMTP to root, exim, and mailman..' enabled but now I have one single php-script that needs to send emails unsing an extenal server
this script is sending mails from different sender-address and each address has it's own username and password

so is there any way to only allow this little part to use outgoing smtp and prevent other scripts / users to do so?
thanks
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
13,259
2,086
363
cPanel Access Level
Root Administrator
Hey there! I don't have a way to add an exception to that rule at this time. Could you use the link in my signature to submit a feature request for that?

Alternatively, could the PHP script get edited to connect to the server as an authenticated user instead? That would resolve the SMTP Tweak issue, and also ensure the mail doesn't get marked as spam at the recipient side since it would be authenticated.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
13,259
2,086
363
cPanel Access Level
Root Administrator
There's many different ways to go about it - while I'm not a PHP developer, this shows one example:

 

herzla

Member
Apr 19, 2021
15
1
3
here
cPanel Access Level
Root Administrator
may there is a misunderstanding..
for sure I send this mails using smtp-authentication!
but when I activate 'Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak) ' I can't connect to an external mailserver..
so my question is how to have this setting active and allow an extra user oder domain to connect to an external mailserver - or only allow TSL for all processes and keep Port 25 restricted except for exim, and mailman
 

herzla

Member
Apr 19, 2021
15
1
3
here
cPanel Access Level
Root Administrator
you say I should authenticate this php-script to run in root-user?? :eek:
i feels like you crashed my thread :(
the setting means 'Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak) '
when I try to connect to the mailserver using telnet in a cpanel-user-terminal I get routed to localhost when this setting is active..
1666039154473.png
1666039176230.png
 

quietFinn

Well-Known Member
Feb 4, 2006
1,775
398
438
Finland
cPanel Access Level
Root Administrator
You can make this to work if you use ConfigServer Security and Firewall (CSF).
 

quietFinn

Well-Known Member
Feb 4, 2006
1,775
398
438
Finland
cPanel Access Level
Root Administrator
I'm using CSF - how you think I could get it work?
1. Disable "Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak) "
2. In CSF -> Configuration -> SMTP Settings SMTP_BLOCK => ON, SMTP_ALLOWLOCAL => ON, SMTP_REDIRECT => OFF, SMTP_PORTS = 25,465,587 and finally in SMTP_ALLOWUSER add the cPanel user(s) you want to allow to bypass SMTP_BLOCK.
 
  • Like
Reactions: herzla