Location: PHPKode > scripts > Free Bulk Mail > bulkmail/bulkmail.php
<?
$cansend = $_POST["canSend"];
if($cansend == 1)
{
$mailfrom = $_POST["txtMailFrom"];
$mailsubject = $_POST["txtSubject"];
$mailbody = $_POST["txtBody"];
$mailsto = $_POST["txtMailTo"];
$mailarray = split(",",$mailsto);
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: $mailfrom\r\n";
foreach($mailarray as $mailto)
{
	echo $mailto."<br>";

	if(mail($mailto,$mailsubject,$mailbody,$headers))
	{
		$status = 1;
	}
	else
	{
		$status = 2;
		$problemid .= $mailto;
	}
}
if($status == 1)
{
	echo "<center><font color=red><b>Successfully sent</b></font></center>";
}
else
{
	echo "<center><font color=red><b>Problem in sending mail for $problemid</b></font></center>";
}
}
?>
<center>
<table border=0 cellpadding=5 cellspacing=2 width=90% align=center>
<tr><td colspan=2 align=center><b>Bulk Mail</b></td></tr>
<form name=form1 method=post action=<?=$_SERVER['PHP_SELF'];?> onsubmit="this.canSend.value=1;return true;">
<tr>
<td>From</td>
<td><p>
          <input type=text name=txtMailFrom style="width: 620px" value="<?php echo $mailfrom;?>">
        </p>
        <p>Senders Name&lt;email id&gt; Eg) Sales Team&lt;hide@address.com&gt;</p></td>
</tr>

<tr>
<td>To</td>
<td><p>
          <input type=text name=txtMailTo style="width: 620px">
        </p>
        <p>( Email id separated by commas. eg) hide@address.com,hide@address.com 
          ) </p></td>
</tr>

<tr>
<td>Subject</td>
<td><input type=text name=txtSubject style="width: 620px" value="<?php echo $mailsubject;?>"></td>
</tr>

<tr>
<td valign=top>Message Body</td>
<td><textarea name=txtBody rows=10 cols=75></textarea></td>
</tr>
<tr>
<td colspan=2 align=center>
<input type=submit value="Send">
</td>
<input type=hidden name=canSend value=0>
</form>
</table>

<p align="right">Powered By: <a href="http://www.ajsquare.com" target="_blank">AJ 
  Square Inc</a></p>
Return current item: Free Bulk Mail