Jump to content


mailing list

  • Please log in to reply
3 replies to this topic

#1 fullyloaded

  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 12 September 2006 - 03:45 AM

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...

#2 tomfmason

  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 12 September 2006 - 04:24 AM

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,

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux

#3 Potatis

  • Members
  • PipPipPip
  • Advanced Member
  • 173 posts
  • LocationSydney, Au.

Posted 26 January 2008 - 12:51 PM

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:

$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";

I have tried single quotes as well. Any ideas?

#4 Potatis

  • Members
  • PipPipPip
  • Advanced Member
  • 173 posts
  • LocationSydney, Au.

Posted 26 January 2008 - 01:49 PM

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?

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users