Best way to send 10,000+ emails with PEAR/Mail_Queue

前端 未结 3 2062
故里飘歌
故里飘歌 2021-01-01 09:46

I have a cron which generates the whole mail info and puts in a database table using $mail_queue->put(.....) with an option to delete emails after they\'re s

相关标签:
3条回答
  • 2021-01-01 09:56

    Personally, I would go the cron way because it gives less opportunity for failure. Say your mail server stops responding or for some other reason becomes unavailable. Or what if your entire network goes offline for a few hours, but the servers are still generating emails. I say use the queue.

    As for the delay thing, just have a service/cronjob pick up the queue every sixty seconds, pop 100 emails and send them, then quit. You might get a queue of emails to be sent but that's going to happen no matter what system you choose. The queue will empty during off-peak hours, anyways.

    0 讨论(0)
  • 2021-01-01 10:04

    why you dont loop through 100 emails and sleep for 60seconds. this costs you no servertime, the only downside your script runs a little longer.

    0 讨论(0)
  • 2021-01-01 10:13

    use two scripts. one for populating your mail_queue table with the emails you need to send and the second script to send those emails in chunks of 90 mails at a go. set the second script to be activated about every 2 minutes or so.

    you could also just upgrade your hosting plan ;-)

    0 讨论(0)
提交回复
热议问题