Send e-mails from DB
I have a MySQL database in which I hold the mail adress from all the users on my website. How can I send an e-mail to each of them?
I guess PHP is a little slow. I've tried a CGI scrip开发者_StackOverflow社区t but it failed (it sent some e-mails then it got stuck xD).
Is there an "usuable" PHP only solution? I only have like 300users atm, but I want the script to work for like 10.000 users.
I've heard about SwiftMailer (or something like that) but I want to know if I can create my own script that can work.
Don't recreate the wheel. SwiftMailer is easy to use, extensible, and very customizable. It also has considerations for throttling and antiflooding.
If it's a timeout issue (mail() function is really slow) I usually use ajax to have the server do a small slice (say 10 rows) at a time. That also gives you feedback about how far along it is in processing the whole file. Each subsequent ajax call tells the server what line to start on, it does 10 sends back a success/fail to the browser/javascript, which sends another ajax request to do another 10, repeat.
精彩评论