Skip to main content

Stop cpanelusername@hostname.tld from sending mail ?

Comments

9 comments

  • 24x7server
    Hello, You can disable your php mail function through with the disable function in php.ini file. Also please give a try with the following command. You will get the directory list which are sending the mails from your server.
    awk '$3 ~ /^cwd/{print $3}' /var/log/exim_mainlog | sort | uniq -c | sed "s|^ *||g" | sort -nr
    0
  • nisamudeen97
    Hi, Thanks for the update. I have already done your suggestions and I am aware about all these. I have already disabled mail function in the server meanwhile what i need is to stop mails which are being of the form "cpanelusername@hostname.tld[/EMAIL]" most probably the mails which are being sent via php scripts in a "suphp" server.
    0
  • 24x7server
    Hello, It's default behavior of Exim mail server is to use the cPanel username and hostname of the server, If the From: field is not formatted correctly, empty or the email address does not exist in the cPanel, the From: address will be changed to cpanelusername@hostname.tld If you want to stop this, You will have to use SMTP authentication instead of php mail in your script to send mail from your server
    0
  • nisamudeen97
    What I want to do is stop mails which are being of the form "cpanelusername@hostname.tld[/EMAIL]" ? ie stop mailing from the scripts that are not using proper authentication to sent mails. Is there any mechanism in exim ? While researching in this topic, I met with the below update. Go to the location WHM >> Service Configuration >> Exim Configuration Manager Under the section filer, you'll see the file used by exim for filtering. Open that file from the backend of your server and add the below piece of code in the end. if first_delivery and ( ("$h_from:" contains "emailtoblock@domainname.com") ) then fail endif Restart exim Is it possible to modify the above if con and prevent all users from sending mail via php script ?
    0
  • cPanelMichael
    What I want to do is stop mails which are being of the form "cpanelusername@hostname.tld[/EMAIL]" ? ie stop mailing from the scripts that are not using proper authentication to sent mails.

    Hello, Are you sure that you have already disabled the mail function of PHP? Users should not be able to send out email through PHP if you have disabled that function. Thank you.
    0
  • nisamudeen97
    Hi Michael, As I have stopped mail function no mails are being sent from the server meanwhile I would like to know if there is some other way to disable "cpanelusername@hostname.tld[/EMAIL]" from sending mails with out disabling php mail () in the server.
    0
  • cPanelMichael
    Hello, This is answered on the following thread:
    0
  • nisamudeen97
    Hi Michael, Thanks for the update, the below post contains answers for my questions.
    0
  • cPanelMichael
    There's no other way I am aware of to stop PHP scripts from sending mails other than by disabling the mail function of PHP in the php.ini file. Thank you.
    0

Please sign in to leave a comment.