Script to send your clients a reminder

890 views
Skip to first unread message

Martin

unread,
Jan 19, 2022, 8:47:05 AM1/19/22
to Easy!Appointments - Support Group
Hi, I was looking for a function to remind my clients that they have a appointment.
I ended up making a custom script which I would like to share with you guys.

There are a few things you need to adjust:
- In the database table ea_appointments you need to add a column:
  - Name : is_reminded
  - Type : TINYINT
  - Default : 0

Here you can find the script https://pastebin.com/pzGjj3KD . (Make sure to enter the information corresponding to your server.)
Just save it as reminder.php and run it every morning with a cronjob!

Alex Tselegidis

unread,
Jan 24, 2022, 3:52:33 AM1/24/22
to Easy!Appointments - Support Group
Hello Martin! 

Thanks so much for sharing this! Great job 🚀

Cheers!


Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!

francisco astorga

unread,
Jan 29, 2022, 3:21:00 PM1/29/22
to Easy!Appointments - Support Group
thank you very much! I really apreciate it!!!

Clément Virmoux

unread,
Feb 1, 2022, 8:33:35 AM2/1/22
to Easy!Appointments - Support Group
Hi Martin !
It works fine, thank you !
I just have a small issue : I can't see the two variables $appointmentTime = $row['start_datetime']; and   $hash = $row['hash']; in the remind email.
The other like $fn are working.
Any idea ?

Thank you.

Martin

unread,
Feb 1, 2022, 12:57:29 PM2/1/22
to Easy!Appointments - Support Group
Hi, not sure about that can you check your EasyAppointments database. In the table ea_appointments you should have 'start_datetime' and 'hash'.
Check line 23 that's where the script query the database for start_datetime and hash.



Op dinsdag 1 februari 2022 om 15:33:35 UTC+2 schreef clement...@gmail.com:

Jos Geluk

unread,
Mar 18, 2022, 4:10:56 AM3/18/22
to Easy!Appointments - Support Group
Very useful, thank you!

Op woensdag 19 januari 2022 om 14:47:05 UTC+1 schreef Martin:

thomas.mo...@gmail.com

unread,
Apr 3, 2023, 9:05:14 AM4/3/23
to Easy!Appointments - Support Group
Hi all, 
Thank you for this great feature Martin. However, I am encountering a database connection error :
"ERROR: Could not connect. Access denied for user 'hf********t'@'*******.net' (using password: YES)"
 Do you have an idea ?

Thx

Thomas

Martin

unread,
Apr 3, 2023, 9:16:00 AM4/3/23
to Easy!Appointments - Support Group
Check line 4,5,6 and 7. You've entered the wrong details most likely.
DB_SERVER should almost always be 'localhost' unless your database is actually running on the domain that you've provided ends with '.net'
If your database is running on that domain then check if you entered the correct details for the database user and that the user permissions to access that database.
If all checks out and it's still not working then you should check if your external database allows remote connections.

Good luck
Op maandag 3 april 2023 om 15:05:14 UTC+2 schreef thomas.mo...@gmail.com:

thomas.mo...@gmail.com

unread,
Apr 3, 2023, 10:16:20 AM4/3/23
to Easy!Appointments - Support Group
Isn't this the same information found in application/config/database.php?

Martin

unread,
Apr 3, 2023, 10:21:54 AM4/3/23
to Easy!Appointments - Support Group

No, it should match the information given in the file config.php at the root of your easy-appointments folder.
The contents should look like this sample file: https://github.com/alextselegidis/easyappointments/blob/master/config-sample.php


// ------------------------------------------------------------------------


// DATABASE SETTINGS


// ------------------------------------------------------------------------




const DB_HOST = 'localhost';


const DB_NAME = 'easyappointments';


const DB_USERNAME = 'root';


const DB_PASSWORD = 'root';
Op maandag 3 april 2023 om 16:16:20 UTC+2 schreef thomas.mo...@gmail.com:

thomas.mo...@gmail.com

unread,
Apr 4, 2023, 8:53:15 AM4/4/23
to Easy!Appointments - Support Group
Thank you very much Martin, it works perfectly 👍. I made a noob mistake on my password 😅.
Last question, do you think it is possible to send the reminder 1 or 2 days before the day of the appointment?

Many thanks

Jos Geluk

unread,
Apr 4, 2023, 9:01:04 AM4/4/23
to Easy!Appointments - Support Group
You can do this instead of setting $today in the original script (lines 18-20):

$tomorrow = date("Y-m-d", strtotime("+1 day"));
$todayStart = $tomorrow ." 00:00:00";
$todayEnd = $tomorrow ." 23:59:59";


This will select appointments with a start date of tomorrow.

Jos
Op dinsdag 4 april 2023 om 14:53:15 UTC+2 schreef thomas.mo...@gmail.com:

Easy!Appointments - Support Group

unread,
Sep 19, 2023, 7:39:23 AM9/19/23
to Easy!Appointments - Support Group
Hi,

Where should I put reminder.php file? Which folder, root of ea?

I'm a bit afraid to write my database credentials to it, how can I use DB_HOST, DB_NAME, DB_USERNAME, DB_PASSWORD const from config.php ?

Thanks
Tamas

Easy!Appointments - Support Group

unread,
Sep 19, 2023, 7:58:25 AM9/19/23
to Easy!Appointments - Support Group
The location of the file shouldn't matter as long as CRON has access to it.
Regarding your security concern: as long as your server and file permissions are set up properly; reminder.php should be as secure as config.php. Since PHP is executed on the server-side meaning only people with access to your web-server can see your database credentials (which should be only you in most cases).
But if you really want you could add your config.php by require_once('path/to/your/config.php');

It's been a while since I made this post, I have updated the code a while back.
For the ones interested: https://pastebin.com/rPLfN3Vr

Op dinsdag 19 september 2023 om 13:39:23 UTC+2 schreef orit...@gmail.com:

Easy!Appointments - Support Group

unread,
Sep 19, 2023, 8:08:28 AM9/19/23
to Easy!Appointments - Support Group
Thank you. You have a controller for this reminder.php file or use use it standaone?

Tamás Orosz

unread,
Sep 19, 2023, 10:26:08 AM9/19/23
to Easy!Appointments - Support Group
I created a cron job. Looks like working, but email is blank what the customer got. While I run manually reminder.php script it works fine. What could be the problem?
Thanks

Martin

unread,
Sep 19, 2023, 10:38:57 AM9/19/23
to Easy!Appointments - Support Group
I suspect you’re using a relative file path to your HTML template. Try using absolute path like:

$message = file_get_contents(__DIR__ . 'absolute/path/to/email_template.html');

Op dinsdag 19 september 2023 om 16:26:08 UTC+2 schreef orit...@gmail.com:

Nico Lambrechts

unread,
Feb 22, 2024, 5:46:14 AM2/22/24
to Easy!Appointments - Support Group
Good day, I don't want to re-invent the wheel -- can someone perhaps share their email_template.html file?

tx,
Nico Lambrechts

Corentin HUCHET

unread,
Dec 22, 2024, 5:25:15 PM12/22/24
to Easy!Appointments - Support Group
Good morning,
How do we modify the database?
Best regards,

The Bat

unread,
Dec 22, 2024, 6:17:16 PM12/22/24
to Easy!Appointments - Support Group
what you want to modify ? you can use phpmyadmin 

Alex Tselegidis

unread,
Jan 10, 2025, 12:09:28 PM1/10/25
to Easy!Appointments - Support Group
A different method would be also to use database migrations 


Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!



Temi B

unread,
Jan 25, 2025, 7:56:32 PM1/25/25
to Easy!Appointments - Support Group
https://pastebin.com/KWXDd2j8

I'm no programmer but this worked with phpmail. I actually didn't test the original before going about trying to change it since mail wasn't working properly before 1.5.1 for me anyway. I don't know how to tie it into the functioning of E!A so I ended up with smtp settings being entered directly. I did manage to get the db stuff from the config.php file. Blocked by the "<?php defined('BASEPATH') or exit('No direct script access allowed')" in the email.php file.

This shouldn't be too hard to make a part of E!A. I intend to create 3 reminder files, since we need to send reminders at different intervals. Also I guess 3 total new columns. Then hourly cron. There's probably a better way to do it. 

Philippe Marty

unread,
Feb 10, 2025, 12:13:35 PM2/10/25
to Easy!Appointments - Support Group
Hello,
This script sends mail via phpmail. To enhance reliability and control, I was wondering if we could modify the code to use the SMTP settings of the application.
How could this be done? Using settings found in the /application/config/email.php file?
Thanks for your help :)
Best regards

Alex Tselegidis

unread,
Feb 17, 2025, 8:36:26 AM2/17/25
to Easy!Appointments - Support Group
Hello! 

> How could this be done? Using settings found in the /application/config/email.php file?

That is correct



Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!


Vivék Pundír

unread,
Apr 14, 2025, 6:28:47 PM4/14/25
to Easy!Appointments - Support Group
Hi Martin,

Apologies if I don't fully understand. Shouldn't the script just read the relevant details from config.php instead of asking for the details itself?

Alex Tselegidis

unread,
Apr 28, 2025, 10:45:54 AM4/28/25
to Easy!Appointments - Support Group
For emails, the framework used to require this info from the email.php file mentioned above. 

For backwards compatibility, this config file was kept in place. 


Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!



Reply all
Reply to author
Forward
0 new messages