PDA

View Full Version : Help with php mail funciton..




Quboid
Aug 31, 2008, 02:03 PM
Hello all,

I am having some trouble with the php mail() function. I followed a few tutorials online, but although the script is being processed, the mail never makes it to my inbox. Can anyone help me out? I'm sure its a simple mistake.

thanks a million!

this is the php script I wrote.


<?

$name=$_POST['name'];
$from_header=$_POST['email'];
$destino=$_POST['destino'];
$origen=$_POST['origen'];
$hotel=$_POST['hotel'];
$adult=$_POST['precio_adult'];
$child=$_POST['precio_child'];
$calif=$_POST['calif'];
$subject="stuff";

$headers = "From: zesco727@hotmail.com";

//echo"$name";

$contents= $name."<br>Destino: ". $destino."<br>Origen: ".$origen."<br>Hotel: ".$hotel."Precio Adulto: ".$adult."<br>Precio Menores: ".$child;


$to="zesco727@gmail.com";

mail('stunnerfresh@yahoo.com', '$subject', '$contents','$headers');


?>


I a using MAMP..



pjrobertson
Sep 1, 2008, 04:32 AM
There's no need to wrap variables in quotes.
Try
mail('stunnerfresh@yahoo.com', $subject, $contents, $headers);


Also, your $to variable doesn't seem to be used anywhere.

finally, instead of <br> (or <br /> depending on your markup version) you can use PHP's newline: \n option.

It's always worth checking your error_log file to see where the error lies.
The location varies on hosts, but it's something like:
/var/log/httpd/error_log