swiftmailer - Error sending more than 300 emails with PHP Swift Mailer showing Internal Server Error -
error sending more 300 emails php swift mailer showing internal server error getting 200 mails out of 300
i using ftp surfer
another problem after sending 200 mails upto 1 hour mails not going showing send not getting mails after 1 hour again getting
mail ids getting mysql database
using each loop mails sending
<?php // create message // create message $message = swift_message::newinstance(); $sql=mysql_query("select * test_email status=''"); while($row=mysql_fetch_array($sql)) { // want replace following static array // dynamic 1 built retrieving users database $users = array( array( "fullname" => "aurelio de rosa", "operations" => $row['sno'], "email" => $row['email'] ) ); // create replacements array $replacements = array(); foreach ($users $user) { $replacements[$user["email"]] = array ( "{fullname}" => $user["fullname"], "{transactions}" => $user["operations"] ); } // create mail transport configuration $transport = swift_mailtransport::newinstance(); // create instance of plugin , register $plugin = new swift_plugins_decoratorplugin($replacements); $mailer = swift_mailer::newinstance($transport); $mailer->registerplugin($plugin); // create message $message = swift_message::newinstance(); $message->setsubject("this email sent using swift mailer"); // create file contents in normal way, don't write them disk // create file contents in normal way, don't write //them disk $type = $message->getheaders()->get('content-type'); $type->setvalue('text/html'); $type->setparameter('charset', 'utf-8'); // use antiflood re-connect after 100 emails $mailer->registerplugin(new swift_plugins_antifloodplugin(100)); // , specify time in seconds pause (30 secs) $mailer->registerplugin(new swift_plugins_antifloodplugin(100, 30)); // create message $message = swift_message::newinstance('my subject'); // set body $message->setbody( '<html>' . ' <head></head>' . ' <body>' . ' here image <img src="http://www.graymatter8.info/developer1/swiftm/x.php?ts={transactions}&&ip='.$ip.'" alt="" width="1" height="1" border="0"/>' . ' rest of message' . ' </body>' . '</html>', 'text/html' // mark content-type html ); $message->setfrom("account@bank.com", "testing"); $failedrecipients = array(); $numsent = 0; // send email foreach($users $user) { $message->setto($user["email"], $user["fullname"]); $mailer->send($message); } ?>
you should send out in packets, 10-20 @ once. package done, can go next 10-20, , on...
Comments
Post a Comment