Email Headers

php India
  • 14 years ago
    In my PHP file i am writing multiple headers like this
    <?php
    $to     
    = '[email protected]';

    $subject = 'the subject';

    $message = 'hello';

    $headers = 'From: [email protected]' . "\r\n" .
      
    'Reply-To: [email protected]' . "\r\n" .
      
    'X-Mailer: PHP/' . phpversion();



    mail($to, $subject, $message, $headers);

    ?>

    It sends mail successfully.
    If i check my mail i will get the from,message and body.
    where can i find the remaining header information(Reply-To and X-Mailer)in my mail.








  • 13 years ago
    that depends on which email client you are using to read the email.

  • 13 years ago
    The extra email headers like reply-to, etc are usually used by the email client in the background to aid in the processing of the email. In the normal course of events you wouldn't have any need to change these headers around. One of the reasons you might is in the case of an email help desk where help tickets are sent to a single email and replies are made from many emails and then all communications should be handled by the same technician. If you are just wanting to send emails then you may want to use the built-in SMTP functions or the php mail() function.

  • 13 years ago

    hello,

    below script is working  you can use script and test on server change email address.

    Actually you are not mentioned message format in header section .

     

    please test script and let me known....

     

    Thanks & Regards

    Rakesh

     

    <?php
    ini_set("SMTP","localhost");
    ini_set("sendmail_from","[email protected]");

    $glb_str_admin_mail   ='[email protected]';

    $to      = '[email protected]'; // put your own email address
    $subject = 'testmail by rakesh';
    $headers = "Content-Type: text/html; charset=utf-8\r\n" ."Content-Transfer-Encoding: 8bit\r\n\r\n";

    // $headers = "From: ".$glb_str_admin_mail."\r\n";

    $headers = "From:". $glb_str_admin_mail . "\r\n" .
       "Reply-To:". $glb_str_admin_mail  . "\r\n" .
       'X-Mailer: PHP/' . phpversion();

    // write message

    $message = 'hello testing mail by rakesh in html format fro rakesh local machine';

    mail($to,$subject,$message,$headers);
    echo "sucessss";
    exit;

    ?>

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Every language has an optimization operator. In C++ that operator is ‘//’”