Swift Mailer and Dream host
Posted: Fri Oct 09, 2009 9:37 am
I've created a mass newsletter send app as part of a CMS for a client. I'm using swift mailer, but I've found that dreamhost doesn't allow for more than 200 recipients while sending email via smtp through your hosting server. I need to be able to send to 1000+. I've tried the antiflood plugin but I have no way to see that its working. But basically what happens when I try to send to 1000 people I get a "500 Internal Server Error".
I even tried using Gmail for SMTP as well, but still same thing. I'd hate to see this app go to waste.
Is there some other server or service I could run this though? Or perhaps I can change how I'm sending the message?
I have an array of all my recipients and I'm looping the send. Then just reporting back on the page which ones worked for now. Here's my code:
I even tried using Gmail for SMTP as well, but still same thing. I'd hate to see this app go to waste.
Is there some other server or service I could run this though? Or perhaps I can change how I'm sending the message?
I have an array of all my recipients and I'm looping the send. Then just reporting back on the page which ones worked for now. Here's my code:
Code: Select all
function send_email_to_single($everything) {
require_once '../swift/lib/swift_required.php'; //require lib
//Create the Transport
$transport = Swift_MailTransport::newInstance();
$mailer = Swift_Mailer::newInstance($transport) or die('Error creating mailer.');
//Or specify a time in seconds to pause for (30 secs)
$mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(50, 30));
foreach ($everything as $single_thing) {
$from = $single_thing[0]; // An array that contains email => name
$recipient = $single_thing[1]; // An array that contains email => name
$body = $single_thing[2];
$text_only = $single_thing[3];
$subject = $single_thing[4];
$message = Swift_Message::newInstance($subject)
->setFrom($from)
->setTo($recipient)
->setBody($body, 'text/html');
if ($mailer->send($message)){
$recieved .= 'success' . $email . '<br />';
} else {
$recieved .= 'error' . $email . '<br />';
}
}
return $recieved;
}