Skip to main content

How to prevent all cPanel PHP mail() to be sent from server hostname?

Comments

8 comments

  • rpvw
    If the problem you are experiencing originates from PHP contact forms hosted on your server, you have a couple of options. By far the best is to use a script that employs authenticated SMTP to send the mail via PHP. This will automatically use the authenticated email account as the envelope from and should pass all spam tests for sender address. The second method is to employ the fifth parameter in the PHP mail() function and set the -f user@domain.tld flag. You should be able to hard code that into the php file that contains the mail() routine. Both the above examples require modifications at the users hosting files. There is no satisfactory way of implementing this with cPanel on a server wide basis as far as I know but you may want to try the EXPERIMENTAL: Rewrite From: header to match actual sender or the Set SMTP Sender: headers in the Exim Configuration Manager, although I have not seen anyone raving over them so far, nor am I at all sure they will solve your problem. :(
    0
  • postcd
    try the EXPERIMENTAL: Rewrite From: header to match actual sender or the Set SMTP Sender: headers in the Exim Configuration Manager

    Thank you for your comment! (though it not solved the issue :confused: ) "EXPERIMENTAL: Rewrite From: header to match actual sender", description: "If you choose the "remote" option, only messages that are being sent to remote destinations will be affected." (in Basic Configuration of the Exim Configuration Manager) i already have this set to "remote", so it appears to me like it is already enabled. I tried to enable it for "all". but still after exim restart, mail is not authorized as per error log lines mentioned. Set SMTP Sender: headers - i already have this set to "on" I do not know what to do, i can not ask all existing and then newly registered users to adjust their scripts.. Also it is not easy for me to migrate to different server provider, current provider told me they can not disable filtering on my IP. :cool:
    0
  • rpvw
    Migrating to another server provider is unlikely to solve the fundamental problem of the php mail() shortfalls. Your problems are not unique to you, they are industry wide. Your users are the ones that should be responsible for sorting out their own software they deployed on your server. Although it is popular for users to blame the web hosting provider, or the reseller, or the data centre, or anyone else other than themselves, the fact is that whoever chose and deployed and maintains the PHP software that they use on their websites is responsible for configuring it in a way that will work. [quote]i can not ask all existing and then newly registered users to adjust their scripts.
    I actually think you can...... I always reach out to my customers and offer commercial support if they need it. After all, this is not actually a server problem. The whole issue would go away if PHP removed un-authenticated mail() functions from their code, and forced everyone to use authenticated SMTP to send their PHP mail.
    0
  • postcd
    Thank you rpvw, i found i can not even send e-mail from my gmail to username@myserver.hostname.here, that e-mail result in same error like when i send e-mail from server (username@myserver.hostname.here) to the outside internet ("You do not have sufficient privileges to send mail to this address. Please authenticate and try again."). The email filtering provider told me it can be cause of whole issue that the mentioned e-mail address does not accept e-mail. o_O Please can i anyhow make it accept the e-mail from the outside internet please? myserver.hostname.here already has a MX record (i added it today): $ dig +short mx myserver.hostname.here [QUOTE]0 myserver.hostname.here
    $ host myserver.hostname.here. [QUOTE] myserver.hostname.here has address MyCpanelServerIP myserver.hostname.here mail is handled by 0 myserver.hostname.here.
    0
  • rpvw
    In the Exim Configuration Manager > ACL Options; Check that you have not enabled: Reject remote mail sent to the server's hostname Reject mail at SMTP time if the recipient is an address of the primary hostname of this server. No remote mail should normally be received for the primary hostname, and this has recently become a common spam target.
    0
  • postcd
    0
  • cPanelMichael
    Hello, I've marked this thread as solved. Thank you.
    0
  • slim
    [QUOTE] the Exim Configuration Manager > ACL Options; Check that you have not enabled:
    Thanks- This helps
    0

Please sign in to leave a comment.