Total Pageviews

Monday, June 6, 2011

mutiple email sending seperation usring comma


<?php
if(isset($_REQUEST['submit']))
{
//$toadd = $_REQUEST['to'];
//define the receiver of the email
$to = $_REQUEST['to'];
$array = explode(",", $to);
//define the subject of the email
$subject = $_REQUEST['subject'];
//define the message to be sent. Each line should be separated with \n
$message = $_REQUEST['textarea'];
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: it.siddarth@gmail.com\r\nReply-To:  it.siddarth@gmail.com";
//send the email
if($to!="")
{
  foreach ($array as $k => $v)
   {
    // echo $v."</br>";
    $mail_sent = @mail( $v, $subject, $message, $headers );
     }
   echo "You have referred the following your friends email ids $to ";
   }
 else
   {
  echo "check ur refferal email_ids";
    }
}
?>
<form id="form_id" method="post" action="mutiplemails.php" >
  <p>Invite Friends Here :
    <input type="text" id="emailq" name="to" />
    <input type="submit" name="submit" value="Invite" />
 subject:
      <input name="subject" type="text"  />
content:
        <textarea name="textarea" rows="5" > </textarea></p>
</form>

No comments:

Post a Comment