Menu

How to have Real name and email

Help
j1010
2007-12-24
2013-06-03
  • j1010

    j1010 - 2007-12-24

    Hello,

    When using FormMail script we used to have realname and e-mail set, so when somebody use form on the site and type name and e-mail address - we would get this in mailbox:
    From: Name <email@example>.

    This was practical since we could reply easily to them without cut/paste address. How can we implement this using PHPform?

    <?php

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

    $headers .= 'Cc: boss@example.com' . "\r\n";

    mail("webmaster@example.com","Contact Requested","Data:

    Name: " . $_POST['field_5'] . "
    Company Name: " . $_POST['field_6'] . "
    City: " . $_POST['field_7'] . "
    State: " . $_POST['field_8'] . "
    Zip Code: " . $_POST['field_9'] . "
    Phone: " . $_POST['field_10'] . "
    Fax: " . $_POST['field_11'] . "
    E-mail: " . $_POST['field_12'] . "
    Message: " . $_POST['field_14'] . "

    ",$headers);

    include("thank_you.htm");

    ?>

     
    • TNTEverett

      TNTEverett - 2007-12-24

      The $header method can accomodate this.
      $headers = 'From: name <email@url.com>' . "\r\n";

      The exact syntax for your form may include some variation of quotes or special character excapes.  Since I have not used this I can not tell you with 100% confidence that the above syntax works.  In any case you can see other examples here:
      http://www.php.net/mail

       

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.