Send email by submitting a form


Rajesh Bhujbal's Blog

An email by submitting a form can be sent as below.The form will send some variables  which will be captured on the script below.

<?php

if(isset($_REQUEST[‘submited’])) {
$name = $_REQUEST[‘name’];
$to = $_REQUEST[’email’];
$somevariable = $_REQUEST[‘somevariable’];

$subject = ” Subject for your email.”;
$body = “Dear “. $name. “<p> Thank you for the email. “.$somevariable .”<p>” . “Regards,” .”<br />”. “Your signature – 0xxxxxxxx91.”;

$from = “yourid@yourdomain.com”;
$headers = “MIME-Version: 1.0” . “\r\n” . ‘Cc: anotherid@yourdomain.com’ . “\r\n”;
$headers .= “Content-type:text/html;charset=iso-8859-1” . “\r\n”;
$headers .= “From: $from”;
mail($to, $subject, $body, $headers) ;

echo “Thank you.A confirmation email is sent to your email id : “.$to;
}else{

echo “Please fill the form to proceed.”;

}

?>

View original post

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