ariamehr14038 Posted March 15 Share Posted March 15 Hello experts, I use this code to send email to myself, as you can see I use header parameter to specify "From: " header: @mail("[email protected]", $_POST['Subject'], $Message . $_POST['Update'], "From: [email protected]"); It works, but the email I get contains this in the headers: X-PHP-Script: www.domain.com/update.php for 93.37.38.39 X-PHP-Originating-Script: 2989:update.php From: [email protected] To remove the above 2 X-PHP headers, someone told me to use: "X-PHP-Script: " To replace the X-PHP headers with null. However, no idea how to use both "From:" headers and "X-PHP" header together. Anyone can help please? :) Quote Link to comment https://forums.phpfreaks.com/topic/327025-mail-function-with-2-header-parameters/ Share on other sites More sharing options...
gw1500se Posted March 15 Share Posted March 15 Use PHPMailer as it is much easier. Quote Link to comment https://forums.phpfreaks.com/topic/327025-mail-function-with-2-header-parameters/#findComment-1651453 Share on other sites More sharing options...
ariamehr14038 Posted March 15 Author Share Posted March 15 Hi, No way, can't change the scripts, just going to get it fixed, can assign an array to the headers to achieve this? If so, how to do? Please help Quote Link to comment https://forums.phpfreaks.com/topic/327025-mail-function-with-2-header-parameters/#findComment-1651455 Share on other sites More sharing options...
gizmola Posted March 16 Share Posted March 16 On 3/15/2025 at 10:42 AM, ariamehr14038 said: @mail("[email protected]", $_POST['Subject'], $Message . $_POST['Update'], "From: [email protected]"); www.domain.com/update.php for 93.37.38.39 X-PHP-Originating-Script: 2989:update.php From: [email protected] To remove the above 2 X-PHP headers, someone told me to use: "X-PHP-Script: " Someone told you? Who was that exactly? This behavior is caused by settings in the PHP.ini. See this page: https://www.php.net/manual/en/mail.configuration.php#ini.mail.add-x-header. You are able to disable these variables in the PHP.in configuration. The mail() function drops mail off for the system Mail Transfer Agent. In many cases, hosting companies utilize those variables to insure that outbound mail is authorized, and this may end up stopping mail delivery. You should contact your hosting provider to inquire about disabling the settings. Quote Link to comment https://forums.phpfreaks.com/topic/327025-mail-function-with-2-header-parameters/#findComment-1651527 Share on other sites More sharing options...
Moorcam Posted Thursday at 08:39 AM Share Posted Thursday at 08:39 AM On 3/16/2025 at 4:42 AM, ariamehr14038 said: Hello experts, I use this code to send email to myself, as you can see I use header parameter to specify "From: " header: @mail("[email protected]", $_POST['Subject'], $Message . $_POST['Update'], "From: [email protected]"); It works, but the email I get contains this in the headers: X-PHP-Script: www.domain.com/update.php for 93.37.38.39 X-PHP-Originating-Script: 2989:update.php From: [email protected] To remove the above 2 X-PHP headers, someone told me to use: "X-PHP-Script: " To replace the X-PHP headers with null. However, no idea how to use both "From:" headers and "X-PHP" header together. Anyone can help please? To remove the X-PHP headers from your email, you can use the ini_set() function to disable the addition of these headers before sending your email. Quote Link to comment https://forums.phpfreaks.com/topic/327025-mail-function-with-2-header-parameters/#findComment-1651792 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.