Tuesday, 12 June 2012

Send Email Through PHP And Auto mail Reply function,

Send Email Through PHP
Step I
create a HTML page 
  1. <html>
  2. <body>
  3. <form method="post" action="email.php">
  4. Name <input type="text" name="name"><br>
  5. Email <input type="text" name="email"><br>
  6. <input type="submit" >
  7. </form>
  8. </body>
  9. </html>

there the method post send the value of all input box to the PHP page

Html page will be look like this








Step II
Create a PHP page

<?php
//get the value send by Method post through HTML page
$name= $_POST["name"]; //value of textbox named "name"

$from= $_POST["email"]; // value of textbox named "email"


$to="xyz@abc.com";        // destination email ID


$subject="email From Satish-sonker.co.in";  // subject of email

$messages="write your message here";

$headers = "From:" . $from;
mail($to,$subject,$messages,$headers);


// //////////////////////////////////////////////////////////////////////////////////////////
//             Auto mail Reply   //////////      /////// //////////////// / / // 
// ////////////////////////////////////////////////////////////////////////////////////////

$reply_msg = "thanx for mailing me";

$reply_header="From:" . $to;


$reply_subject=
" auto reply";
$reply_to= $from;

mail( $reply_to , $reply_subject , $reply_msg , $reply_header);
?>

No comments:

Post a Comment