Thread: php question
View Single Post
  #2  
Old 06-28-2011, 07:41 PM
ruletka ruletka is offline
Member
 
Join Date: Aug 2010
Location: WA
Posts: 13
Gender: Female
Credits: 1,668
ruletka
Wink

Code:
<?php 
 $theiremail = $_REQUEST['email']; 
 $to = 'youremail@live.com';
 $fields = array(); 
 $fields{"email"} = "Email"; 
 $body = "\n\n"; foreach($fields as $a => $b){ 	$body .= sprintf("%20s: %

s\n",$b,$_REQUEST[$a]); } 
 
 $headers2 = "From: $theiremail"; 
 $subject2 = "Someone contacted you"; 
 $autoreply = "".$theiremail."";
 
 if($theiremail == '') {print "You have not entered an email, please go 

back and try again";} 
 else { 
 
 $send = mail($to, $subject2, $autoreply, $headers2); 
 if($send) 
 {header( "Location: http://www.site.com/thanks" );} 
 else 
 {print "We encountered an error, please notify 

webmaster@YourCompany.com"; } 
 }
?>
I got the code from http://php.about.com/od/phpapplicati...orm_mail_3.htm and I altered it.

Last edited by ruletka; 06-28-2011 at 07:52 PM.
Reply With Quote