I am trying to make a customer support mailer. I downloaded the basic script from somewhere, I can't remember the site but it just had two form inputs for 'email 'and 'message'.

What I want is not all too different, just a couple more input values

  $name            = $_REQUEST['name'] ;
  $email           = $_REQUEST['email'] ;
  $paypalemail     = $_REQUEST['paypalemail'] ;
  $paypalrecieptid = $_REQUEST['paypalrecieptid'] ;
  $message         = $_REQUEST['message'] ;

  mail( "support@mysite.com", "Support Request",
    $paypalemail, $paypalrecieptid, $message, "From: $email" );
  header( "Location: supportsent.php" );

The original script worked fine, but once I added in the extra form variables and did my best to edit the last few lines so that I could recieve the data, it stopped working. It is a simple form, just 4 text inputs and a <textarea>.

What am I doing wrong? I feel that it has to be the last couple lines.

Best Regards
~Ross Vaughn 🙂

    
      $name            = $_REQUEST['name'] ;
      $email           = $_REQUEST['email'] ;
      $message     = $_REQUEST['paypalemail'] ;
      $message.= $_REQUEST['paypalrecieptid'] ;
      $message.= $_REQUEST['message'] ;
    
      mail( "support@mysite.com", "Support Request", $message, "From: $email" );
      header( "Location: supportsent.php" ); 
    

    mail()

      That works, but the recieved email is all jumbled onto a single line.
      Sorry I don't understand how to do this. :queasy:

        Because in your message you need to use new line \n

        If you set your content type as HTML you could then render HTML in the email. Do yourself a favor too and validate that information being submitted.

          foyer;10918633 wrote:

          Because in your message you need to use new line \n

          If you set your content type as HTML you could then render HTML in the email. Do yourself a favor too and validate that information being submitted.

          Yes I saw that "\n" posted on the page dagon gave, even though I could only understand about 12% (weird number :queasy: ) of the information on that page I had a feeling that I had to do something with "\n"

          So do I need to do

          \n $message
          \n $message.
          \n $message.
          

          ?

            more like

            $message = "This is an email \n new line \n new line \n new line";

              But it looks like to me that putting a "." after each variable ($message.) just appends the data sent from the form all into a single variable $message, so how could I make it break a new line after the end of the value of each variable if it is all put into a single variable?

                Well.. if you are using a <textarea> field for your $message var ($_REQUEST['message']) than you shouldn't be having any issues. If you start a new line in <textarea> it will still be there in the email.

                  $message = $REQUEST['paypalemail'] ;
                  $message1= $
                  REQUEST['paypalrecieptid'] ;
                  $message2= $_REQUEST['message'] ;

                  $message="$message
                  $message1
                  $message2
                  ";

                  That will do due to you are sending a plain text email.

                  If you are sending the html format email
                  $message="$message<br>
                  $message1<br>
                  $message2
                  ";

                  Also make sure you valid the user input such as $email to prevent the email header injection attacks.

                    I'am sorry but I feel really stupid that I dont understand anything I'am being told in this thread :-P

                    This is my "Staff support page"- http://viraltwittertreasure.com/support.php
                    - 4 text inputs and a textarea

                    The code provided by dagon sends the submitted values to the email account, but in the email all the submitted values are crammed into a single continuious line when I want the email format to look like:

                    Name: Jack Bauer
                    PayPal email: JackBauer@paypal.com
                    PayPal reciept ID: 123456789
                    Message: I have an issue or problem ... blah blah blah

                    I dont need HTML format, and the contact email should be part of the header (?) so that after reading it in gmail I can just hit the reply button.

                    Thats why I thought that

                    mail( "support@mysite.com", "Support Request", 
                        $name \n $paypalemail \n $paypalrecieptid \n $message, "From: $email" ); 
                    

                    would do the trick

                      $message = $REQUEST['paypalemail'] ;
                      $message1= $
                      REQUEST['paypalrecieptid'] ;
                      $message2= $_REQUEST['message'] ;

                      $message="$message
                      $message1
                      $message2
                      ";

                      For plain text email, just try this, this will break the lines.

                        blackhorse is right, but your code throws a parse error

                        mail( "support@mysite.com", "Support Request",
                            $name n $paypalemail n $paypalrecieptid n $message, "From: $email" );
                        

                        This should look like this

                        mail( "support@mysite.com", "Support Request", "$name \n $paypalemail \n $paypalrecieptid \n $message", "From: $email" );
                        

                          For some reason this forum wont display it when I type \n between the PHP-/PHP tags

                          And the code above works

                          $message = $_REQUEST['paypalemail'] ;
                          $message1= $_REQUEST['paypalrecieptid'] ;
                          $message2= $_REQUEST['message'] ;
                          
                          $message="$message
                          $message1
                          $message2
                          ";
                          

                          But is it the manually breaking each variable into a new line what causes the submitted email to display correctly?

                            Write a Reply...