PHP Scripts

Use your server's PHP engine to mass mailout.

Need to send a newsletter to your clients?

No, you don't need to buy a mass mailer. Let your server do it .
Upload all your contacts (in this example a simple MySQL table, named mail with one column named address)

If you want a personalised letter, add more columns in your database, eg, name, company and so on

<?php
// connect to your database in the usual way

//this is a bulk emailer
//use carefully!!!!
$sql = mysql_query("SELECT * FROM mail",$db);
$num_rows = mysql_num_rows($sql);
while ($row = mysql_fetch_array($sql)) {

// take weight off the server CPU by waiting 10 seconds between each mailout.
sleep(10);

if (!mail($row["address"],
$subject = "Newsletter",
$message = "Hi there ..
Your text goes here.

Every new line will automatically carriage return in the email, while a \n on the end of a line forces a carriage return.
More text (chat chat chat).
(add $name or $company in the text if you have the columns in your table)

","From: joe.bloggs@blogcity.com\n"))
{

echo "<FONT FACE=VERDANA, ARIAL SIZE=2 Color=Blue>E R R O R <FONT Color=Blue> : Mail has not been sent to " . $row["address"] . "</FONT><BR>\n";
} else {
echo "<FONT FACE=VERDANA, ARIAL SIZE=2>" . $row["address"] . "</FONT><BR>\n";
}

}
mysql_close($db);

?>


 

Back