Jump to content

Emailing members


ninedoors

Recommended Posts

I am having a problem emailing the members of my site at the same time.  My host limits me to emailing 50 members at a time and only 50 members every five minutes.  I have around 400 members and so I am wonderign if anyone else has run into this problem and what some possible solutions would be.  Thanks for the help.

 

Nick

Link to comment
https://forums.phpfreaks.com/topic/150694-emailing-members/
Share on other sites

I email all my email members individually

 

I created field in my data base which is emailed and set it to 'No' as the default value then I call each member from the database one by one then send the email to $email called from the database WHERE emailed='No' then update the database changing emailed to Yes this is all done in an if link and when the database has no more memebers where emailed = No it goes to the else statement updates the database resets emailed to 'NO' then exits.

Link to comment
https://forums.phpfreaks.com/topic/150694-emailing-members/#findComment-791628
Share on other sites

here is my script beware i am using a DB Class so you might want to edit those bits.

 

<?PHP
ini_set ("display_errors", "1");
error_reporting(E_ALL);

include("global/connection.php"); 






$sql = "SELECT * FROM tblmember WHERE emailed='No' order by intUserID DESC ";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result))
{
    $sid   = $row["intUserID"];
    $email = $row["email"];
    $name  = $row["name"];
}


if ($email==true)

{

$to = "$email";
$subject = "$subject";
$MsgHeader  = "From: Website <[email protected]> r\n";
$MsgHeader .= "MIME-Version: 1.0\n";
$MsgHeader .= "Content-type: text/html; charset=iso-8859-1";
$MsgBody = "
<html>
<head>
<title>HTML message</title>
</head>
<body>
<table>
<tr><td>Hello $name</td></tr>
</table>

</body>
</html>";
mail($to, $subject, $MsgBody, $MsgHeader);


	$sql01 ="update tblmember set emailed='Yes' where intUserID=$sid ";
	$DB_site->query($sql01);
	header("Location:submitletter.php");
	exit;

}
else

{

	$sql02 ="update tblmember set emailed='No'";		
	$DB_site->query($sql02);
	header("Location:index.php");
	exit;


}

?>

 

hope this is of some help only problem is it will take 400 / 50 x 5 to execute it wont stop until it has mailed them all mm so 40 minutes i see your problem is the 50 every 5 minutes in your php ini file?

Link to comment
https://forums.phpfreaks.com/topic/150694-emailing-members/#findComment-791631
Share on other sites

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.