Jump to content


This topic is now archived and is closed to further replies.


mailing list

Recommended Posts

i was wonderinf if anyone knew where i can get a simple emailing list program that will hookup to my websites database i have a dating website and dont have this on there need it to send emails to my members thanks...

Share this post

Link to post
Share on other sites
Here is a simple one.

include("db.php"); // your database connection file
$subject = "Some Subject";
$headers = "FROM: you@yoursite.com";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: multipart/alternative;\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: 7bit";
$headers .= "\r\n";

$sql = mysql_query("SELECT * FROM `yourtable`") or die(mysql_error());
$i = 0;
while ($rw = mysql_fetch_assoc($sql)) {
    if ($i = 20) {
        $i = 0;
     $message = 'Hello ' . $rw['username'] . ',
      This is a test mass mail.';
     $to = $rw['email'];
     mail($to, $subject, $message, $headers);

Hope this helps,

Share this post

Link to post
Share on other sites
Sorry for bring up such an old post, but I guess this is what happens when you use the search function.  :P

The script above works perfectly for me to be able to send a message to each person in my database to alert them when I have updated their points BUT ONLY if I write a single line message like in the example above.

I have been trying to get multiple lines to work, but everything I try breaks the loop. The first user in the database gets the notification, and it formats perfectly, but no further emails are sent.

This the code I tried to add:

[code]$message = "Hello, \n\n";
$message .="The quiz results have been processed! \n\n";
$message .="Please visit http://domain.com/ to see how you fared against everyone else. \n\n";
$message .="Admin \n\n";[/code]

I have tried single quotes as well. Any ideas?

Share this post

Link to post
Share on other sites
Ah, ok, the multiple lines work when I remove the web address. It's a shame the web address breaks the loop, does anyone know if there is a syntax that will stop the web address from breaking the loop?

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.