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 "
 Mobile No: " 
$mobile"
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 ");

}
}?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s