Menu

Email header How to change it

Help
Rohdim
2010-10-12
2013-06-03
  • Rohdim

    Rohdim - 2010-10-12

    Hi
    I am using aform generated  with the phpformgenerator , it is a great script and thanks to the programer , it does really help.

    the only thing I want to change is the email header .
    In the "FROM" section it does show  the server address and the domain name .
    is there any way to change it to the  person' s  email address who sent the email ?
    Thanks for your help

     
  • Anonymous

    Anonymous - 2010-10-13

    Hello,

    Make to following change in processor.php:
    Change this:
    ");

    include ("confirm.html");
    To this:
    ",$headers);

    include ("confirm.html");

     
  • Rohdim

    Rohdim - 2010-10-15

    Hi
    Thanks for the reply , unfortunately  I am still getting the  Server' s  name in the header of the email message !

    If I may ask you about this line of code

    .strrev(strstr(strrev($_SERVER),"/"));]

    It looks to me to be responsible for my problem ???
    Any way to change it  with the email address of the sender ?

    Sorry to bother you again, I really appreciate your help

     
  • TNTEverett

    TNTEverett - 2010-10-15

    Your processor.php file mail() function has a line that starts like this:
    mail("email@url.com","phpFormGenerator - Form submission","Form data:

    The PHP mail() function syntax is identified here:
    http://www.php.net/manual/en/function.mail.php

    The processor.php has the simplest implementation (example #1 in the link above) of the function and to accomplish what you want it is best to follow example #2 in the link above. 
    If you still have issues then come back and I will see if there is some other way of helping you accomplish what you want. 

     
  • jordan

    jordan - 2010-10-18

    Im trying to do the same thing, everything is working fine, I just want to have the forms header to take the email from the email field of the form. This way I can just reply to the email and everything will work great.
    My processor.php looks like this:

    <?php

    $where_form_is="http://".$_SERVER.strrev(strstr(strrev($_SERVER),"/"));

    // File upload handling
    if($_FILES!=''){
    $field_12_filename = "file_12_".date("sihdmY").substr($_FILES,strlen($_FILES)-4);
    if(!move_uploaded_file($_FILES, "./files/".$field_12_filename)){
    die("File " .  $_FILES . " was not uploaded.");
    }
    }

    // File upload handling
    if($_FILES!=''){
    $field_13_filename = "file_13_".date("sihdmY").substr($_FILES,strlen($_FILES)-4);
    if(!move_uploaded_file($_FILES, "./files/".$field_13_filename)){
    die("File " .  $_FILES . " was not uploaded.");
    }
    }

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

    mail("jordan@xtrememaching.com","RFQ from xtrememachinc.com", "Form data:

    Name: " . $_POST . "
    Title/Position: " . $_POST . "
    Company Name: " . $_POST . "
    Email: " . $_POST . "
    Phone: " . $_POST . "
    Fax: " . $_POST . "
    Have You Purchased From Us Before?: " . $_POST . "
    Respond By Date: " . $_POST . "
    Prefered Response: " . $_POST . "
    Specifications: " . $_POST . "
    Special Instructions: " . $_POST . "
    Add A File: ".$where_form_is."files/".$field_12_filename." (original file name: " . $_FILES . ")
    Add Another File: ".$where_form_is."files/".$field_13_filename." (original file name: " . $_FILES . ")

    From Xtrememachinc.com
    ",$headers);

    include("confirm.html");

    ?>

    As you can see, the email is field_4. I know quite a bit of bash scripting but php is completely new to me. I tried for about 20-30 minutes to get it to work but couldnt. I think I just need to know how to use a variable for field_4 on this line: "$headers = 'From: webmaster@example.com' . "\r\n" ."

    any help or input is greatly appreciated. And thank you to phpformgenerator, I will be donating!

     
  • TNTEverett

    TNTEverett - 2010-10-19

    $headers = 'From: '. $_POST . "\r\n" .
        'Reply-To: webmaster@example.com' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();

     
  • jordan

    jordan - 2010-10-19

    well that worked. thank you! although im still having an issue, when i reply it wants to send it to the email that it was sent to, not that it says its from. might be an issue with my email. i have the form sent to a website email, and that email is forwarded to a gmail account.

     
  • jordan

    jordan - 2010-10-19

    Yeah, my gmail is the one with the issue, if I go to the domain email and hit reply it sets it up to send to email from the form. Once again, thanks for your help!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.