pontypete Posted January 6, 2012 Share Posted January 6, 2012 Hi all, I am wondering what the best way to do this is... Take GoDaddy for example, if your domain is about to expire you will get an automatic email. I am wanting to do something similar, If someone orders a Soap Dispenser, I want to send an email (if they accept to receiving emails on the order) each month asking/reminding them to top up on soap. I have been reading but cant find anything adequate, I have seen something about Cron Jobs, but never heard of this before, please could you point me in the right direction. Thanks in advance. Peter Quote Link to comment https://forums.phpfreaks.com/topic/254512-database-driven-auto-e-mail-schedulesender/ Share on other sites More sharing options...
jcbones Posted January 6, 2012 Share Posted January 6, 2012 Crontab (cron job) is to Linux what Schedule Task is to Windows. Crontab reference What does this all mean? Well, you create a php script that does the desired task, then set the crontab to execute that script at a certain time. To list out your example, it would flow as. Crontab calls a php file. The php file checks to see if someones domain is about to expire, if it is and they are not flagged as email sent, they are sent an email. Then their account is flagged as email sent. Script ends. Quote Link to comment https://forums.phpfreaks.com/topic/254512-database-driven-auto-e-mail-schedulesender/#findComment-1305037 Share on other sites More sharing options...
PhunkRabbit Posted January 6, 2012 Share Posted January 6, 2012 What jcbones said above is absolutely correct. I produced a "mini CRM" for a client of mine which does a very similar task. My client installs fireplaces, gas stoves etc and can also provide servicing for all the products they install (to comply with warranty). My system allows them to enter client details, add jobs and schedule when services are due (11 months from the job date), it will then produce an email that reminds my client that x amount of services are due of which they can then act upon. To give you another example like above but for your specific situation: You have a database that collects customer information once they purchase a soap dispenser. Every day at 7am a cron tab or cron job (these are really easy to setup in an admin panel such as CPanel but can also be done manually) executes a PHP script that does the following: Check the database for customers who purchased a soap dispenser. Check that the customer is happy to be emailed. Build the email (Dear John, don't forget new soap for your "xj2000 super soaper", click here to order.....) etc Send the email. etc Quote Link to comment https://forums.phpfreaks.com/topic/254512-database-driven-auto-e-mail-schedulesender/#findComment-1305040 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.