Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

mass email from hosting account



9:58 pm on Jan 6, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

I want to email all my customers about a my new site launch, can I just do it through a while loop, something like this:

$qry = mysql_query("SELECT * FROM `customers2` WHERE `sent`=0");
while($row = mysql_fetch_assoc($qry)) {

// email customer
$customer_email = $row['customers_email'];
$subject = 'new site';
$message = "Welcome to our new site";
$from_email = 'info@mysite.com';
$mail = mail($customers_email,$subject,$message,$from_email);

// update database
echo $customers_id = $row['customers_id'];
if($mail) {
$pwd_qry = mysql_query("UPDATE `customers2` SET `customers_password`='$new_password',`sent`=1 WHERE `customers_id`=$customers_id");
echo ' mail sent<br />';
} else echo ' mail send fail<br />';


4:08 am on Jan 8, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

I would use Mailman in cPanel if your host offers it. You get the advantage of bounce management and allow the user to opt out on their own.

Mailman also has the ability to work with your host's maximum emails per hour and queue those that exceed their limit. A script will run all emails and the host's email server will send all up to the limit and drop the remainder. Resending the remainder may be further hampered by short term hold off period imposed (in reaction to the mass mail) or may have a hard block that requires you to explain why it should be undone.

Doing it your way, while it is very crafty leaves the aforementioned maintenance tasks to another set of manual tasks :-)


11:22 am on Jan 8, 2014 (gmt 0)

WebmasterWorld Senior Member swa66 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

UPDATE `customers2` SET `customers_password`='$new_password',


passwords have 3 rules on how to handle them:
1. Never store the password itself, store a hash instead
2. Always use a random salt that changes for every user
3. Use a SLOW hash

Otherwise any compromise will expose all your users' passwords (and they do reuse their passwords des[pite plenty of warnings not to do that) so it is a big deal.


11:45 pm on Jan 9, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Yes, yes, the password will be crypted.

So with mailman, does that mean I can access the database whilst sending mails still. I am actually wanted to reset everyones password and send them a new one, whilst running this mail campaign?


1:29 am on Jan 10, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Ok I checked my hosting company, and they said I have php mailer. I don't even know what that means, how do I use it?

Featured Threads

Hot Threads This Week

Hot Threads This Month