homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

mass email from hosting account

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

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)

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)

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)

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)

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?

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved