Thanks a lot for all the information you have posted.
Here's my working Cron Job line
(fires every 5 minutes)
I have a question concerning your approach though.
I changed the "notification.php" for the masterpage to "contract.php", since in my case, the information about the contract is set in the "contract" template. "notifications.php" is just containing the code for the cron job.
That would look like this:
If I understand correctly, let's say the cron job is running every 5 minutes, this "notifications.php" page would be fired, a bit like if someone would visit it, every 5 minutes.
In your example (and the code I pasted above), that would only send emails from pages that has the "my_datetime >= '2018-04-25 06:09'" and "my_datetime <= '2018-04-25 06:11'" data saved. So if I have multiple pages with the notification set to this time and date, the email will look like this, let's say I have 2 of them set for the same time, right? :
Since it will find 2 pages?
I need to make sure that even if there's multiple pages with the same date and time for the notification section, it sends 1 email per pages.
Before going further, can you confirm this is possible if I follow your instructions?
Thank you very much
Here's my working Cron Job line
(fires every 5 minutes)
- Code: Select all
*/5 * * * * /usr/local/bin/php /home/USERNAME/public_html/calendar/notifications.php
I have a question concerning your approach though.
I changed the "notification.php" for the masterpage to "contract.php", since in my case, the information about the contract is set in the "contract" template. "notifications.php" is just containing the code for the cron job.
That would look like this:
- Code: Select all
<cms:pages masterpage='contract.php' show_future_entries='1' custom_field="my_datetime >= '2018-04-25 06:09' | my_datetime <= '2018-04-25 06:11' " >
<cms:send_mail from='admin@mysite.com' to='johndoe@gmail.com' subject='Feedback from your site'>
Hello <cms:show client_name/>, here's the link to access your contract for the event that will happen on <cms:show start_date/> at <cms:show start_time/>:
<cms:k_page_link/>
Thank you
</cms:send_mail>
</cms:pages>
If I understand correctly, let's say the cron job is running every 5 minutes, this "notifications.php" page would be fired, a bit like if someone would visit it, every 5 minutes.
In your example (and the code I pasted above), that would only send emails from pages that has the "my_datetime >= '2018-04-25 06:09'" and "my_datetime <= '2018-04-25 06:11'" data saved. So if I have multiple pages with the notification set to this time and date, the email will look like this, let's say I have 2 of them set for the same time, right? :
- Code: Select all
Hello <cms:show client_name/>, here's the link to access your contract for the event that will happen on <cms:show start_date/> at <cms:show start_time/>:
<cms:k_page_link/>
Thank you
Hello <cms:show client_name/>, here's the link to access your contract for the event that will happen on <cms:show start_date/> at <cms:show start_time/>:
<cms:k_page_link/>
Thank you
Since it will find 2 pages?
I need to make sure that even if there's multiple pages with the same date and time for the notification section, it sends 1 email per pages.
Before going further, can you confirm this is possible if I follow your instructions?
Thank you very much