How to bulk send emails

I should send thousands of email in reaction to a specific event, so the email sending is not manual but it’s automatic.

The server where is hosted my website has an hourly limit for email sending (about 500 for hour) so I need to partition it.

Is there some plugin that has that feature? Or some PHP library that helps me to do that?

Thanks

2 Answers
2

I don’t think using sleep() is a good idea, because it takes up resources while it’s sleeping, and you could run into script timeout issues.

I also don’t think it’s a good idea to be sending any important or bulk e-mails from a web server, because that’s not really what’s it’s designed to do. Messages sent from standard mail() / wp_mail() functions are more likely to be flagged as spam than those sent from real MTAs; You don’t get any notice when messages bounce; The host may drop the messages because you overstep some arbitrary limit, or because they think you’re spamming, and there’s a good chance they won’t even let you know they’re doing it; etc…

I think the best way to do this would be to use a service that’s designed to send bulk e-mail, like MailChimp. It will be much more reliable and efficient. You can use plugins like Import Users to MailChimp to sync your WP user accounts with the campaign members. There are also plugins like MailChimp STS to relay WP-generated messages through MailChimp. You may need to search the plugin repository to find exactly what you need, but there are a lot of MailChimp related plugins available.

If you do insist on sending the messages from your web server, you should at least use a library like SwiftMailer instead of wp_mail(). It goes to great lengths to reduce the likelihood of the message being mistakenly flagged as spam, and has an advanced batch-sending system.

Leave a Comment