Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here is what I did recently in PHP on one of my bigger systems:</p> <ol> <li><p>User inputs newsletter text and selects the recipients (which generates a query to retrieve the email addresses for later).</p></li> <li><p>Add the newsletter text and recipients query to a row in mysql table called *email_queue*</p> <ul> <li>(The table email_queue has the columns "to" "subject" "body" "priority")</li> </ul></li> <li><p>I created another script, which runs every minute as a cron job. It uses the <a href="http://swiftmailer.org/">SwiftMailer</a> class. This script simply:</p> <ul> <li><p>during business hours, sends all email with priority == 0 </p></li> <li><p>after hours, send other emails by priority</p></li> </ul></li> </ol> <p>Depending on the hosts settings, I can now have it throttle using standard swiftmailers plugins like antiflood and throttle...</p> <pre><code>$mailer-&gt;registerPlugin(new Swift_Plugins_AntiFloodPlugin(50, 30)); </code></pre> <p>and</p> <pre><code>$mailer-&gt;registerPlugin(new Swift_Plugins_ThrottlerPlugin( 100, Swift_Plugins_ThrottlerPlugin::MESSAGES_PER_MINUTE )); </code></pre> <p>etc, etc..</p> <p>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</p> <pre><code>$message-&gt;setReturnPath </code></pre> <p>Which I now use to track bounces...</p> <p>Happy Trails! (Happy Emails?)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload