Mail Script in PHP


//error_reporting(0);
//ini_set('display_errors','off');
//ini_set('memory_limit', '-1');


 <?php
 
if(isset($_POST) && !empty ($_POST["txtname"]) ){



$name = strip($_POST['txtname']); 
$mail = strip($_POST['txtemail']); 
$mobile = strip($_POST['txtmobile']); 

$headers =  "From: ".$mail."\r\n"; 

$headers .= 'MIME-Version: 1.0' . "\r\n"; 
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 
$headers .= "\r\nX-Mailer: PHP/" . phpversion(); 

$subject = " Mail for related to your query ";
$message = "Name: " . $name . "<br> Mobile No: " . $mobile. "<br/>Email Id:".$email   ;

 
$to = EMAIL_TO ; // define php constant 


 
if(mail($to , $subject , $message , $headers )){ 


header('location: yourpage.php?msg=mail send successfuly '); 


} else { 



header("location: yourpage.php?msg=please try again ");

}
}
?>

Comments

Popular posts from this blog

Call PHP Function In JavaScript Using Ajax

List of Post Category Wise in wordpress