Version: 1.1
Type: Full Script
Category: Other
License: GNU General Public License
Description: Send mail automaticly based on an attribute from a database.
Can send up to 4000 mail list.
Has a delay between sending mails to avoid crashing the mail server (This setting can be change manually on the script).
<?php //Script by nadzree //[email protected] ?> <HTML> <BODY> <?php //To set the Php.Ini in the server ini_set("SMTP","SMTP.blabla.com");//SMTP Server ini_set("sendmail_from","[email protected]");//Sender set_time_limit(19200);//Greater time limit.This is to make sure the page can operate in 5 hours.Input in second if(empty($SEND)) { $SEND=""; } switch($SEND) { case "Send": if(!empty($MESSAGE)) { $HEADERS = "MIME-Version: 1.0rn"; $HEADERS .= "Content-type: text/html; charset=iso-8859-1rn"; $HEADERS .= "From: Subject to be added <[email protected]>rn";//Sender's address $linkID = mysql_connect("localhost","root","");//MySQL connection mysql_select_db(Database, $linkID);//Database name $obRS = mysql_query("SELECT Attribute(Email) FROM Table", $linkID);//Where the mail attribute while($row = mysql_fetch_row($obRS)) { foreach ($row as $field) { mail($field, $SUBJECT, $MESSAGE, $HEADERS); print "Message sent to: <b>$field</b><br>"; echo date('h:i:s'); } sleep(60);//Delay before proceeding to another mail.Input in Second. } mysql_close($linkID); ?> <br> <table width="500" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="2"><hr> <div align="center"><b>Message Detail</b> </div> <hr></td> </tr> <tr> <td width="57"><b>Subject:</b></td> <td width="443"><?php echo $SUBJECT ?> <div align="left"></div></td> </tr> <tr> <td><b>Message:</b></td> <td> </td> </tr> <tr> <td colspan="2"> <?php echo $MESSAGE ?></td> </tr> </table> <?php } break; default: ?> <FORM ACTION="Automail.php" METHOD="POST" NAME="FORM1"> <table width="501" border="0" cellpadding="0" cellspacing="0" bordercolor="#ECE9D8"> <tr> <td colspan="2"><div align="center"><span class="style2"></span></div> <span class="style2"><hr align="center"> <div align="center">Auto Mail</div> <hr align="center"></span></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td width="51">Subjek:</td> <td width="450"><input name=SUBJECT type=TEXT size="75" ></td> </tr> <tr> <td colspan="2">Insert your message or HTML code below </td> </tr> <tr> <td colspan="2"><textarea name=MESSAGE cols="65" rows="15"></textarea></td> </tr> <tr> <td> </td> <td><div align="right"> <input type="reset" name="Reset" value="Reset"> <input type="submit" value="Send" name="SEND" > </div></td> </tr> </table> </FORM> <?php } ?> </BODY> </HTML>