RE: $subject = "form results " causing problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Looks like you may be using the wrong format for the mail() function.

bool mail ( string to, string subject, string message [, string
additional_headers [, string additional_parameters]] )

http://us4.php.net/manual/en/function.mail.php

 Reference the form you should be passing params and notice that the subject
should be the second param.

-M

> -----Original Message-----
> From: Patrick Roane [mailto:fojomo@xxxxxxxxxxxxx] 
> Sent: Wednesday, February 02, 2005 6:08 PM
> To: php-windows@xxxxxxxxxxxxx
> Subject:  $subject = "form results " causing problem
> 
> I was wondering why when I insert the $subject = "form 
> results", I get the ...echo "Message failed to send";
> 
> error.
> 
> But when I comment this out, everything works fine.
> Please see below.
> 
> <?php
>   } else {
>    error_reporting(0);
>       // initialize a array to 
>       //hold any errors we encounter
>       $errors = array();
> 
>       // test to see if the form was actually 
>       // posted from our form
>       // In testing, if you get an Inavlid referer error
>       // comment out or remove the next three lines
>       $page =
> $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
>       if (!ereg($page, $_SERVER['HTTP_REFERER']))
>          $errors[] = "Invalid referer";
> 
>       // check to see if a name was entered
>       if (!$_POST['from'])
>          $errors[] = "Name is required";
> 	  // check to see if email was entered
> 	  if (!$_POST['email'])
>          $errors[] = "a valid e-mail address is required";
>       // if there are any errors, display them
>       if (count($errors)>0) {
>          foreach($errors as $err)
>             echo "$err<br>\n";
>          echo "<br>Please use your browser's Back button to fix.";
>       } else {
>          // no errors, so we build our message
>       $subject = "form results";
>       $recipient = 'fojomo@xxxxxxxxx';
>       $phone = stripslashes($_POST['phone']);
>       $from = stripslashes($_POST['from']);
> 	  $mail = stripslashes($_POST['email']);
>       $comments = "Comments from:
> $from\n\n".stripslashes($_POST['comments']);
>       if (mail($recipient, $comments, $phone, $mail, $subject)){
>

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux