Swift Mailer and Dream host

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
matthewordie
Forum Newbie
Posts: 3
Joined: Mon Jul 20, 2009 1:32 pm

Swift Mailer and Dream host

Post by matthewordie »

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:

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;
}
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Re: Swift Mailer and Dream host

Post by dude81 »

I suppose they do it because, they do not want their IP address to get black listed, try sending them in a period of batches of every 30 minutes send 200 each.
matthewordie
Forum Newbie
Posts: 3
Joined: Mon Jul 20, 2009 1:32 pm

Re: Swift Mailer and Dream host

Post by matthewordie »

Ya, I did setup a queue with a cron script. Right now I have it running every 5 mins and it sends out 100 at a time. It's working so far.

Dreamhost does have some pretty strict spam policies and they will ban your account on the first offense.


Does swift mailer use forged headers to create its mail? Like for my "FROM" address? Because that's a big no no with dreamhost and I'm a little worried about that.
Post Reply