Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-27-2012, 06:58 PM   PM User | #1
hans_cellc
New Coder

 
Join Date: Oct 2011
Posts: 92
Thanks: 38
Thanked 0 Times in 0 Posts
hans_cellc is an unknown quantity at this point
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
hans_cellc is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:19 PM.


Advertisement
Log in to turn off these ads.