Jump to content

Recommended Posts

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? :)

Link to comment
https://forums.phpfreaks.com/topic/327025-mail-function-with-2-header-parameters/
Share on other sites

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.

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.