How to schedule emails according to a given date - php

I am supposed to send an automatic e-mail through the system using PHP codeigniter on the Windows platform.
I have to schedule an email, which is automatically sent, for instance at a birthday of a person.
Is this possible?

Yes It is Possible. You will need to have a script that will check for today's Bitrhday's and send mails to the users.
Then You need to schedule this script to run everyday at a fixed time. You can achive this by setting a CronJob in your system. I think you have some kind of Scheduler for Windows Platform but i have been working with UNIX so i am not sure about windows.
Also You will have to take a look at :
Running CI Script from CLI

Related

PHP-send an email at specific time

My system is for reservations, and I want to send a reminder email 15 minutes before without using cron on Linux/Unix/BSD boxen nor Scheduled Tasks on Windows because I'm using mac and the users' PCs will be windows.
So, what should I do?
Initially, I compared all date and time with the ones in the data base but still nothing arrived.
Thanks in advance.
I tried if the date&time now = the date&time in the DB send a conformation email.
and about the corn I have 2 things:
1- I'm using mac -as a programmer- and if I want to implement this function I'll have to use Scheduled Tasks on Windows which - as I think- will be need working on a windows environment.
and the system will be installed on a Microsoft PC.
2- I have not dealt with corns before, and I'm afraid it'll take time that I don't have.
You have to use some kind of service or job to trigger the email to be send. Because php is self needs to know when to exec the code ("script").
Use CRON or Task Scheduler or build your own job / Service
For Scheduling jobs on linux you can you at command. Here is example
at 12:32 -m -f /usr/local/bin/backup-script
Here is good manual for at linux.
http://www.brunolinux.com/02-The_Terminal/The_at_Command.html
If you want to avoid cron job, then you have to depend on some hacky solution to trigger/call your "send email" code
like,
depend on site users. If they are coming on regular intervals every minute, check on each reservation the upcoming reservation time and email to them.
run a daemon process OR a function that keeps running for a specific period of time, say 24 hours, and check for upcoming reservations every minute or xyz time. You can put this process on sleep for a minute (or more) to check reservations on regular intervals.
use 3rd party cronjob scripts or hosted cronjobs. like https://www.setcronjob.com/ (needs $ for this solution) or onlinecrontab.com

Configure Scheduled Task in wamp Server [duplicate]

I want to schedule sending of email from php script. I want user to specify date and time and then on the specified date and time, I want those emails to be sent automatically. How do I implement it? I am working on codeigniter.
One way to do it would be to create a "scheduled_emails" database table. Put all the emails you want to queue in there, including columns such as, recipient, subject, message and optional headers.
You could then set up a script to look at that table and send any emails that have a "send_time" which is greater than the current time. You could then set up a cron job to run this script every.. 5 minutes for example.
PHP usually uses an external scheduler for this sort of thing. That means cron on *nix or Windows Task Scheduler on Windows.
If you want to set it up through a web interface, then you might consider storing your schedule in a database and having cron (etc) kick off a script that looks for overdue emails every 5 minutes.

Sending Mail automatically at a particular time?

I am going to add one module to my project this module is about remainders.If today's date is a birthday of a person then a mail must be send to that person automatically at 9.00 A.M
If your xampp is on Windows, you can use windows-schedulers to call a
particular script (PHP script in your case, preferably by an URL),
which checks the birthdays of all the users and sends them mail
accordingly.
If your xampp is on Linux/Unix/etc, you can use cron-jobs,
and rest is same!
There is also a third way, a third-party scheduler or say online-cron, which will remotely
call yours script (php-page).
Example:
If you are doing the cron-settings of OS yourself, you can still let
the configure as to whom to email in your system, rather than OS.
After all, a cron so is to do something repeatedly, in your case, its
just calling your scripts, by an URL.
Now regarding the time settings, you can make the CRON call your
script every our, and you php script will check the appropriate time,
and fire the mails!
Reference: Send mail to different customer on their birthday
Hope this helps..
You could always add a cron job/scheduled task that runs at 9 am and hits a service that checks if any mail needs to be sent out that day.

Send mail to different customer on their birthday

I have found that there is related topic.However, there are some difference because the people is asking for ubuntu server but i am using the Apache (xampp****) the latest version, so are there any method to let the system automatically send mail by checking the date ?
Can it applies to some schedule sending as well? thanks
I have the script for sending it , the only thing i need is how to schedule send.
Edit:
Make it simpler , assuming only windows is the only platform. Can i do some php script and create the cron job in os , so that my client can schedule their mail in my system instead of doing it in the os?
3 rd party cron job is good suggestion but there is limitation (what if their service break down etc...) and i want everything is based on own system
If your xampp is on Windows, you can use windows-schedulers to call a particular script (PHP script in your case, preferably by an URL), which checks the birthdays of all the users and sends them mail accordingly.
If your xampp is on Linux/Unix/etc, you can use cron-jobs, and rest is same!
There is also a third way, a third-party scheduler or say online-cron, which will remotely call yours script (php-page).
Example:
If you are doing the cron-settings of OS yourself, you can still let the configure as to whom to email in your system, rather than OS.
After all, a cron so is to do something repeatedly, in your case, its just calling your scripts, by an URL.
Now regarding the time settings, you can make the CRON call your script every hour, and your php script will check the appropriate time, and fire the mails!
schedule a script in crontab or scheduler which will check the birthday of your customer
and send them an email
this script will run everyday at particular time of the day
use server cron job to run a script that will send out email. ur script should compare current's date and customer's birthday date.
You could use a cron-job. With PHP that get all the people that you want to send an email and gets template and send it just substitute the name and other stuff
You may use Wishing Application. Getting started provides good details on how to kick started. At minimal you need only two things the excel file having wish details (Birthday and on work anniversary), and a configuration file (application.properties) to provide the mapping details and other configurations. There are various options to run this application, locally (background, foreground, docker, windows-scheduler etc) on cloud
Disclaimer : I am the owner of application.

How do I set automatic reminder email using PHP?

We are running a webinar. I want to send reminder email to all those registered on my site 3 days before the webinar.
The registrant details are in my MySQL and it is a PHP website.
How do I do that?
Any help would be highly appreciated!
Thanks,
PHP can't do that by itself as it is not a program running constantly on a server. It is only run when a user requests a web page. You would need to set up a cron job on the server that calls a PHP script to do the emails.
First, your database would need a field that says whether you have already sent the email or not. Your PHP email script would check if it is 3 days or less until the event, and you have not already sent an email to that person, then send it.
Then you would call that script from a cron job. You can run PHP from the command line, or alternatively use something like curl or wget to fetch the URL as if you were running the script in a web browser. (That would also mean you can run the cron job from another computer if necessary.)
You could set a cronjob to run a reminder script at a specific time 3 days before your webinar. Your script would loop through your user data and send email using some variation of php's mail function.
Not sure what your server type is but if you are running cPanel here is a link to their docs on how to set up a cron job:
http://docs.cpanel.net/twiki/bin/view/AllDocumentation/CpanelDocs/CronJobs
Let us know which of the above you're not sure about and we can provide some more info.
PHP doesn't have built-in schedulers.
You should consider using cron on unix/linux
or
Schedulers on Windows
or
There are some online crons available.
which will call your php-scripts. (which will internally do the task of mailing)
Note: the links above refer to drupal sites, but explanations given there with regards to cron and schedulers are applicable in pure-php.

Categories