Help with php mail funciton..

Discussion in 'Mac Programming' started by Quboid, Aug 31, 2008.

  1. macrumors 6502

    Joined:
    Oct 16, 2006
    Location:
    everywhere
    #1
    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.

    Code:
    <?
    
    $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..
     
  2. macrumors 6502a

    Joined:
    Nov 14, 2007
    #2
    There's no need to wrap variables in quotes.
    Try
    PHP:
    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
     

Share This Page