hashstar Posted June 4, 2012 Share Posted June 4, 2012 Hi there, I am using php mailer and this piece of code: <?php require('connect.php'); // Grab our config settings require_once($_SERVER['DOCUMENT_ROOT'].'/config.php'); // Grab the FreakMailer class require_once($_SERVER['DOCUMENT_ROOT'].'/include/MailClass.inc'); $result_message = ''; if (isset($_POST['submit'])) { $errors = array(); if (empty($_POST['email_addresses'])) { $errors['emails'] = 'No emails selected.'; } // here you can/should loop through and verify email addresses to avoid spamming; put a restriction to # of emails allowed to be sent, etc. // santizing/controlling your email functions is greatly overlooked and can cause your site to be dropped by your hosting provider if your site is being used to send gobs of spam if (empty($errors)) { $result_message = 'There was a problem sending this mail!'; // instantiate the class $mailer = new FreakMailer(); // Build foreach ($_POST['email_addresses'] as $email_address) { $mailer->AddBCC($email_address); } // Set the subject $mailer->Subject = 'New Products from The Organic Grow Shop'; $mailer->isHTML(true); if ($mailer->Send()) { $result_message = 'Mail sent!'; } $mailer->ClearAddresses(); $mailer->ClearAttachments(); } } $sql = "SELECT * FROM mailinglist"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result) > 0) { echo (!empty($result_message) ? $result_message .'<br/><br/>' : ''); echo " <h1>Mailing List</h1> Send to<br/><br/> <form action='send.php' method='POST'> "; while ($getrow = mysql_fetch_assoc($result)) { echo "<input type='checkbox' name='email_addresses[]' value='". $getrow['email'] ."' unchecked='unchecked'/>". $getrow['email'] ."<br>"; } echo "<input type='submit' name='submit' value='Send »'/></form>"; } else { echo 'Add some email addresses.'; } } else { trigger_error(mysql_error()); } ?> I can send emails to multiple address ok, have tested sending to 5 addresses at once and this worked fine, but when i try and send the email to everyone in my database it doesn't work. I think what might be happening is that there are emails in my database that aren't correct and this is stopping it from sending out the rest of the emails when it gets to that point. Does that sound plausible? What else could it be? is there a way to weed out any incorrect emails from my database? Any help is much appreciated!!! Quote Link to comment https://forums.phpfreaks.com/topic/263631-problem-sending-multiple-emails-with-phpmailer/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.