How can one send an email to 100,000 users on a weekly basis in PHP? This includes mail to subscribers using the following providers:
It is important that all e-mail actually be delivered, to the extent that it is possible. Obviously, just sending the mail conventionally would do nothing but create problems.
Is there a library for PHP that makes this simpler?
This question is related to
php
email
email-integration
mailing-list
massmail
People have recommended MailChimp which is a good vendor for bulk email. If you're looking for a good vendor for transactional email, I might be able to help.
Over the past 6 months, we used four different SMTP vendors with the goal of figuring out which was the best one.
Here's a summary of what we found...
Conclusion
SendGrid was the best with Postmark coming in second place. We never saw any hesitation in send times with either of those two - in some cases we sent several hundred emails at once - and they both have the best ROI, given a solid featureset.
Here is what I did recently in PHP on one of my bigger systems:
User inputs newsletter text and selects the recipients (which generates a query to retrieve the email addresses for later).
Add the newsletter text and recipients query to a row in mysql table called *email_queue*
I created another script, which runs every minute as a cron job. It uses the SwiftMailer class. This script simply:
during business hours, sends all email with priority == 0
after hours, send other emails by priority
Depending on the hosts settings, I can now have it throttle using standard swiftmailers plugins like antiflood and throttle...
$mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(50, 30));
and
$mailer->registerPlugin(new Swift_Plugins_ThrottlerPlugin( 100, Swift_Plugins_ThrottlerPlugin::MESSAGES_PER_MINUTE ));
etc, etc..
I have expanded it way beyond this pseudocode, with attachments, and many other configurable settings, but it works very well as long as your server is setup correctly to send email. (Probably wont work on shared hosting, but in theory it should...) Swiftmailer even has a setting
$message->setReturnPath
Which I now use to track bounces...
Happy Trails! (Happy Emails?)
Source: Stackoverflow.com