mail() problems

Discussion in 'PHP' started by D_C, Oct 15, 2009.

  1. #1
    Is there any reason why the following script would not send an email?

    
    $to = "darkcard2000@aol.com" ;
    						$subject = "Order" ;
    						$message = "$name has placed an order with us. Here is the clients contact information:<br> <br> Name: $name <br> Email: $email <br> Phone Number: $phone <br><br> They have decided that the computer they want will be: $premade . <br> Further Specifications Include: <br><br> Primary Use: $use <br> CPU Speed: $cpu <br> CPU Cores: $cores <br> RAM Amount: $ram <br> RAM Speed: $ramspeed <br> Graphics Chipset: $gpc <br> Graphics Speed $gps <br> Graphics Memory: $gmp <br> SLI: $sli <br> Hard Disk Size: $hdd <br> CD/DVD Drive: $cddvd <br> Blu-Ray Drive: $bluray <br> SD Card Reader: $sd <br> Cooling Type: $cooling <br> Specific Requests: <br> $requests <br><br> Please forward this email to the following people: Robert Braun, and Nick Siebenlist. Nick, create and price out an estimate fitting, as much as possible, the customers request. Then forward the excel sheet to Robert and Chris. Robert, make a log of the clients contact information and its current status. Send the clients information in an excel sheet to Nick and Chris. Chris, store all user and order information accordingly on the server." ;
    						$from = "From $email" ;
    						
    						
    						mail( $to,$subject,$message,$from );
    
    PHP:
    I have tried replacing the <br>'s with \n's but I still do not get an email. No error occurs. and $email is specified.
     
    D_C, Oct 15, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    There needs to be a : after From.

    
    $headers = 'From: webmaster@example.com' . "\r\n" .
        'Reply-To: webmaster@example.com' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();
    PHP:
     
    premiumscripts, Oct 15, 2009 IP
  3. szalinski

    szalinski Peon

    Messages:
    341
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    also, check your mail error logs just in case it still doesn't work.
     
    szalinski, Oct 16, 2009 IP
  4. prasanthmj

    prasanthmj Member

    Messages:
    62
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    45
    #4
    Correct the code this way:
    
    $to = "darkcard2000@aol.com" ;
    $subject = "Order" ;
    $headers = "From:yourname@your-website-name.com\r\n" ;
    $headers .= "Reply-To:$email\r\n" ;
    mail( $to,$subject,$message,$headers );
    
    PHP:
    For details, see:
    Why is my PHP script not sending emails?
     
    prasanthmj, Oct 16, 2009 IP