1 Reply Latest reply on Jan 10, 2009 9:01 AM by Newsgroup_User

    PHP Sendmail Small Problem

    Coxdabd Level 1
      Hi there,

      I'm using a PHP send mail script to email the form results over to me. For the message, I want several fields to be in the actual message. I've seen that you simply need to insert the '.' However this simply seems to put the additional fields on the end of the previous. I want it as a separate paragraph as it were. The code is below:


        • 1. Re: PHP Sendmail Small Problem
          Level 7
          On Sat, 10 Jan 2009 15:25:20 +0000 (UTC), "Coxdabd"
          <webforumsuser@macromedia.com> wrote:

          > <?php
          > $name = $_REQUEST['name'] ;
          > $message = $_REQUEST['telephone'] ;
          > $message .= $_REQUEST['required'] ;
          > $message .= $_REQUEST['date'] ;
          > $message .= $_REQUEST['time'] ;
          >
          > mail( "enquires@me.com", "Booking Request",
          > $message, "From: $email" );
          > header( "Location: http://www.me.com" );
          > ?>

          Try it this way:

          <?php
          $name = $_REQUEST['name'] ;
          $message = sprintf("Telephone: %s\n",$_REQUEST['telephone']);
          $message .= sprintf("Required: %s\n",$_REQUEST['required']);
          $message .= sprintf("Date: %s\n",$_REQUEST['date']);
          $message .= sprintf("Time: %s\n",$_REQUEST['time']);
          mail( "enquires@me.com", "Booking Request",
          $message, "From: $email" );
          header( "Location: http://www.me.com" );
          ?>

          Currenly your form is very insecure. You should see some of these:
          http://www.google.com/search?q=php+mail+header+injection

          Gary