How can i disable php mail function?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cristian
    Junior Member
    Forum Explorer
    • Mar 2021
    • 18

    #1

    How can i disable php mail function?

    Hello!

    I like to disable the mail() function in php just for one domain/customer.

    Can i do that? How?

    Thanks!
  • steve
    Junior Member
    • Jul 2017
    • 29

    #2
    This is the way I do it.
    Its the only method Ive been able to figure out, and there might be a much better way to do it, but it works for me.

    1. Edit /etc/cl.selector/php.conf

    2. Add these lines right at the top of the file:

    Code:
    Directive = sendmail_path
    
    Default   = /usr/sbin/sendmail -t -i
    
    Type	= list
    
    Range    = /usr/sbin/sendmail -t -i,/bin/true
    
    Comment   = Switch to /bin/true to disable php mail
    3. In the clients cpanel, change the sendmail path to /bin/true using "Select PHP Version > Switch to PHP Settings"
    He will no longer be able to send via php mail

    Comment

    • cristian
      Junior Member
      Forum Explorer
      • Mar 2021
      • 18

      #3
      If it works its perfect for me.

      Thanks!!!

      Comment

      • Kyo
        Junior Member
        • Apr 2023
        • 1

        #4
        how can we do it for DirectAdmin?

        Comment

        • bogdan.sh
          Administrator
          • Nov 2016
          • 1221

          #5
          Originally posted by Kyo
          how can we do it for DirectAdmin?
          I believe the same should work for DirectAdmin as well.
          Just be aware we are talking about the case when a customer is using 'our' PHP Selector only. And user will have a control for this function so can turn back On when needed.

          Comment

          Working...