What's the best approach to sending email to hundreds of recipients from a Zend Framework application?

前端 未结 8 1055
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-29 08:44

I\'m trying to implement a mailing list system for my application. I\'m currently using Zend_Mail_Transport_Smtp(\'localhost\') as my transport, looping through

8条回答
  •  死守一世寂寞
    2020-12-29 09:20

    I implemented a bulk mailer in php where each email was customized to an individual. It wasn't hard and didn't take too long. I used swiftmailer and cron. Zend Mail might be ok as well. I started with the PEAR mail queue, but queueing up the emails was much too slow.

    The process of queueing emails went like so:

    1. Create the email template and add placeholders (or use a template engine) for areas where unique content will be substituted.
    2. In a loop, substitute placeholders with in any unique content, insert the resulting email content, subject, addresses, batch id, and optionally a priority value to a database table.

    I used a cron job to send out batches of emails. The cron time interval and the number of emails sent per batch were important since I was on a shared host with limits. The script that was called by the cron job was only accessible by cron. The script read x number of emails from the table ordered by batch id and, optionally, priority. If an email was sent successfully, it was deleted from the database queue. If an email couldn't be sent, it remained in the queue and a counter was incremented for that record. If a counter was over a set number, then the email was deleted from the queue.

提交回复
热议问题