Looking for an open source cron emailing solution - php prefered [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this questionI need tos et up my application to send out periodic emails for my social networking site. The frequency of emails would be very sporadic based upon user interactions. FOr example my site has a QnA module - I allow users to follow questions, so every time an answer is posted all followers of the question would get an email.
I was thinking of implementing this using a cron job which would run periodically in the back ground at 5-10 minute intervals. The idea is that whenever an update is made an entry is made into a database with the list of recipients and email body. A cron job would then periodically check the database for any such jobs and execute it upon which the job would be marked as executed.
I was wondering if theres anything open source which can help me here. I just need code which sends emails in 开发者_运维问答the background and all I have to provide it is the database table for the emails to send to as well as the email body.
Mail() with php
Sending bulk email in PHP
Sending mass email using PHP
Best way to send 10,000+ emails with PEAR/Mail_Queue
How can I debug a PHP CRON script that does not appear to be running?
Cron job to execute a PHP program
If you already have database writing your own php script is not that hard just use default mail() or some other lib (as suggested swift) function and put it elements form database, then just run that script with cron. Sure i may be wrong since i'm python programmer, but in the way i see its just a mailing function with cycle and some SQL query that would give for example 5 mails each minute.
Pros of that:
- You will learn something (most probably).
- You will spend less time than searching for openSource alternative that will require some editing that will suit you needs.
Take a look at Swift mailer (http://swiftmailer.org) and phpMailer (http://phpmailer.worxware.com).
assuming your server has mail(), you should just be able to do something like this
$sql = ;//Sql query to grab data
$rs = ;// Result of sql query
if(sizeof($rs) > 0)
{
foreach($rs as $item)
{
mail($to, $subject, $message, $headers);
// SQL query to update rows saying its been sent out or something like that
}
}
精彩评论