Mail your problems to us on lawania@lavania.in, we will solve it and put the solution here at Lawania.com

PHP program to send email, from any sender to any receiver, any time, form email






<html>
<body>


<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
  {
  //send email

$sBoundary = md5(mt_rand());

$sTimestamp = $_REQUEST['date'];

$senderemail = $_REQUEST['email'] ;
$receiveremail = $_REQUEST['remail'] ;
$bcc = $_REQUEST['bccmail'] ;
$message = nl2br($_REQUEST['message']) ;
$subject = $_REQUEST['subject'] ;



$sHeaders = "Date: $sTimestamp\n" ."From: ". $senderemail . "\r\n" ."Reply-To: " . $GLOBALS ["Email"]["ReplyToAddress"] . "\r\n" ."Bcc: ". $bcc . "\r\n".
"MIME-Version: 1.0\r\n" . "Content-Type: multipart/alternative; ".
"boundary=$sBoundary\r\n\r\n" .
"This is a multi-part message in MIME
format.\r\n\r\n";

$sBody = "--$sBoundary\n" .
"Content-Type: text/plain;
charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
 "\n\n" .
"--$sBoundary\n" .
"Content-Type: text/html; charset=\"iso-8859-1\"\n"
.
"Content-Transfer-Encoding: 7bit\n\n" .
 "\n\n" . $message;




mail($receiveremail, $subject,$sBody, $sHeaders);

echo "Thank you for using our mail form";

  }
else
//if "email" is not filled out, display the form
  {
  echo "<form method='post' action='m.php'>
  Sender Email: <input name='email' type='text' /><br />
  Receiver Email: <input name='remail' type='text' /><br />
  BCC Email: <input name='bccmail' type='text' /><br />
  Send Date : <input name='date' type='text' value='YYYY-MM-DD HH:MM:SS' /><br />

  Subject: <input name='subject' type='text' /><br />
  Message:<br />
  <textarea name='message' rows='15' cols='40'>
  </textarea><br />
  <input type='submit' />
  </form>";
  }

?>

</body>
</html>
Share on Google Plus

About Lawania Krishan Kant Lavania

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.