PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Dec 18, 2018 9:28 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Oct 09, 2009 9:37 am 
Offline
Forum Newbie

Joined: Mon Jul 20, 2009 1:32 pm
Posts: 3
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:

Syntax: [ Download ] [ Hide ]
 
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;
}


Top
 Profile  
 
PostPosted: Sat Oct 10, 2009 12:30 am 
Offline
Forum Regular
User avatar

Joined: Mon Aug 29, 2005 6:26 am
Posts: 509
Location: Pearls City
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.


Top
 Profile  
 
PostPosted: Mon Oct 12, 2009 10:43 am 
Offline
Forum Newbie

Joined: Mon Jul 20, 2009 1:32 pm
Posts: 3
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group