Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1

Thread: mail() function

  1. #1
    New Coder
    Join Date
    Oct 2011
    Posts
    92
    Thanks
    38
    Thanked 0 Times in 0 Posts

    Smile mail() function

    Please assist, below is my code. Everything works perfectly except the second mail() function that is suppose to email the responder with a thank you email as well but it does not. WHY???????

    Code:
    <?php 
    $to = "lynette@skies.co.za"; 
    $from = $_REQUEST['email'] ; 
    $fields = array(); 
    	$fields{"firstname"} = "First name"; 
    	$fields{"lastname"} = "Last name"; 
    	$fields{"email"} = "Email"; 
    	$fields{"telephone"} = "Telephone number"; 
    	$fields{"type"} = "Type of Feedback"; 
    	$fields{"purchase"} = "Purchase a Yorkie"; 
    	$fields{"owner"} = "Own a Yorkie";
    	$fields{"qnty"} = "How many"; 
    	$fields{"breeder"} = "Breeder";
    	$fields{"letter"} = "Subscribe to Letters"; 
    	$fields{"pups"} = "Subscribe to new Pups";
    	$fields{"updates"} = "Subscribe to Updates"; 
    	$fields{"registrations"} = "Subscribe to Registrations";
    	$fields{"message"} = "Message";        
     
    $body = "We have received the following information:\n\n"; 
    foreach($fields as $a => $b){ 	
    	$body .= sprintf("%22s: %s\n", $b, $_REQUEST[$a]); 
    	}
    $subject = "SA Yorkies - Contact Form";
    $subject2 = "Thank you for contacting us"; 
    $headers = "From: $from";  
    $headers2 = "From: lynette@skies.co.za"; 
    $autoreply = "Thank you for contacting us. We will get back to you as soon as possible, usualy within 48 hours. 
    If you have any more questions, please email us at: lynette@skies.co.za 
    or visit our website at: www.skies.co.za";
    
    mail($from, $subject2, $autoreply, $headers2); 
    $send = mail($to, $subject, $body, $headers); 
    
    
    echo $send2;
    
    if($send) {
    	header( "Location: http://www.skies.co.za/thankyou.html" );
    	} 
    else {
    	print "We encountered an error sending your mail, please notify lynette@sayorkies.co.za"; 
    	} 
    ?>
    Last edited by hans_cellc; 09-27-2012 at 07:44 PM. Reason: The code actually works, delay in email server


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •