Jump to content

Creating a mass email system


topflight

Recommended Posts

I currently have 4 groups in my database and I want to have it set up so if the admin select one group and type a message in, it will email all the members in that group, but if the admin select ALL members it will email all member. I already have the form made out but I am confused on how to get started on this. Please help.

 

 

Thanks in Advanced!

Link to comment
https://forums.phpfreaks.com/topic/148616-creating-a-mass-email-system/
Share on other sites

 

Here a grate example i just done for you.

 

Donation page is on the forum ....

 

enjoy.........

<?php

//database connection.

if(isset($_POST['submit'])){

$update_group=trim(mysql_real_escape_string($_POST['update_group']));

$sql="SELECT * FROM what_evaer where group='$update_group'";

$res=mysql_query($sql)or die("There a select problam".mysql_error());

if(mysql_num_rows($res)){


	while($group_data=mysql_fetch_assoc($res)){


		$to = $group_data['group_email_address']; 		



		$mess="bla blaa blaaa blaaa blaaaaaa blaaaaaaaaaaa!";


$message=$mess;

    
$subject = 'This is a email from who_ever.!'; 


$headers = 
        'X-Mailer: PHP/' . phpversion() . "\r\n" .
        "MIME-Version: 1.0\r\n" .
        "Content-Type: text/html; charset=utf-8\r\n" .
        "Content-Transfer-Encoding: 8bit\r\n\r\n";

echo"You have sent email to the current email address:";

if(mail($to, $subject, $message, $headers)){


echo"<br>$to<br>";

exit;
          }
	   }
	    }
             }

echo" <form method='POST' action='{$_SERVER['PHP_SELF']}'>";

echo "<center><select name='update_group'><option value=' '>Selected</option>";

$select_array=array("a","b","c","d");


foreach($select_array as $array_selected){

echo"<option value='$array_selected'>$array_selected</option>";
}

echo"</select><br><br>";



echo "<input type='submit' name='submit' value='Send the update via a group'>";

echo"</center></form>";

?>

Would there be away of limiting the number of users this sends an email to!

 

For example you tap in your message click submit and it sends to the first 100 email address in the database then you have to click a continue button or something to send to the next 100.

 

Just that if you have say 10,000 people in your database the server will not like that and it may crash.

Archived

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

×
×
  • Create New...

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.