Menu

How to add From: and Cc: to processor.php?

Help
2008-03-04
2013-06-03
  • Mario Maillet

    Mario Maillet - 2008-03-04

    Hello,

    I would like to add From: and Cc: to processor.php and the information would be taken from the submitted form, i.e. From: would use the information submitted in 'field_1' and Cc: would use the information submitted in 'field_3'.  Is this possible?

    Here is my current processor.php script.

    ****************************************
    <?php

    $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

    mail("test@test.com","Test Subject Line","The following form has been submmited:

    --=SUBMITTER'S INFORMATION=--
    Name:
    " . $_POST['field_1'] . "

    Affiliation:
    " . $_POST['field_2'] . "

    Email:
    " . $_POST['field_3'] . "

    Telephone number:
    " . $_POST['field_4'] . "

    Website:
    " . $_POST['field_5'] . "

    --=SPEAKER'S INFORMATION=--
    Name:
    " . $_POST['field_6'] . "

    Affiliation:
    " . $_POST['field_7'] . "

    Email:
    " . $_POST['field_8'] . "

    Telephone number:
    " . $_POST['field_9'] . "

    Suggested title of presentation:
    " . $_POST['field_10'] . "

    Presentation related theme (or stream):
    " . $_POST['field_11'] . "

    Comments:
    " . $_POST['field_12'] . "

    ");

    include("confirm.html");

    ?>
    ****************************************

     
    • TNTEverett

      TNTEverett - 2008-03-05

      Possible but not a good idea.  Do this against my recommendation as it leaves your form open for attack and abuse.

      Examples on email header formats can be found here:
      http://us3.php.net/mail

       
    • Mario Maillet

      Mario Maillet - 2008-03-05

      I was able to get the From field working, but didn't have such luck with the Cc field.  As a work around, I have the form being email to a specified email (currently shown as test@test.com and to the address entered by the user in the email field (field_3).

      *****************************************
      <?php

      $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

      $headers .= "From: ".$field_1."<".$field_3.">".$eol;

      mail("test@test.com,$field_3","Subject","The following form has been submmited:

      --=SUBMITTER'S INFORMATION=--
      Name:
      " . $_POST['field_1'] . "

      Affiliation:
      " . $_POST['field_2'] . "

      Email:
      " . $_POST['field_3'] . "

      Telephone number:
      " . $_POST['field_4'] . "

      Website:
      " . $_POST['field_5'] . "

      --=SPEAKER'S INFORMATION=--
      Name:
      " . $_POST['field_6'] . "

      Affiliation:
      " . $_POST['field_7'] . "

      Email:
      " . $_POST['field_8'] . "

      Telephone number:
      " . $_POST['field_9'] . "

      Suggested title of presentation:
      " . $_POST['field_10'] . "

      Presentation related theme (or stream):
      " . $_POST['field_11'] . "

      Comments:
      " . $_POST['field_12'] . "

      ", $headers);

      include("confirm.html");

      ?>
      *****************************************

       

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.