How do appointment reminders work?

I got my instance setup sending email notifications with mailgun, that works fine I’ve already tested it and it successfully sends any of the default reminders after I enable it in: Administration > Practice > Rules

What I can’t figure out is how to send appointment reminders, I’ve made an appointment for a patient and I expect it to send them an email notification once the appointment is scheduled.

I added this to my cron as it specifies in the wiki:

* */1 * * * /var/www/html/openemr/modules/sms_email_reminder/cron_sms_notification.php

* */1 * * * /var/www/html/openemr/modules/sms_email_reminder/cron_email_notification.php

But I never receive any notifications, whats interesting is the apache log says this:

sendmail: can't connect to remote host (127.0.0.1): Connection refused` but I'm not using sendmail.

I have also tried sending emails via the batchcomm tool but that also gives me this error:

Could not send email due to a server problem. 1 emails not sent

When I go to Administration > Patient Reminders I have no appointment reminders queued up to send & process.

Is there another undocumented step I need to do? I just find it weird it works with any of the other reminder rules but not appointment reminders.

Could you resolve the sending of the mail? I’ve wanted to do it for a long time, but it doesn’t work for me. Please, could you tell me how you configured the rule to send mail.
Thanks You very much.
luis

@luisuriarte unfortunately I have not figured it out yet, I do know it involves messing around with Practice Rules and the Batchcomm, when I figure it out I will write up a tutorial and share it with the community.

1 Like

Tank You.
I was able to manage to send messages, but they are sent to all patients, whether or not they have appointments (alone, installing simple, basic postfix) on my centos. They do not load the variables in the mail appears (Only NAME): "Name Bartholomew SIMPSON. You have a turn at our clinic with the doctor *** PROVIDER *** on the day *** DATE *** at the time ** * DATE ***. Please show up 15 minutes early. Thank you very much. "… only *** Name *** load.

Can you share how you got it to send messages? I really want to be able to send emails when an appointment is made but haven’t figured it out yet.

Thanks.

Yes, after installing postfix on my RHEL 8.3. I did it via batchcomm.
(sorry for my spanish)

And I got this:


I only recognize the variable *** NAME ***
luis

1 Like

Yeah I get errors when trying to send emails with batchcomm

The only clue I get from apache logs is this:

sendmail: can't connect to remote host (127.0.0.1): Connection refused

Which seems bizarre to me since I have my settings to use mailgun so IDK why it’s trying to use sendmail.

It does however send emails successfully if I use Administration > Patient Reminders > Process and Send Reminders.

I just need to figure out how to get the appointment rule I created to actually show up and be able to be processed.

I created a new rule: office appointment (Recordatorio Turno):


In administration/otient/patien reminder:

In e-mail:
Clinic Reminder: “Dear Lisa, This is a message from your clinic to remind you of your Reminder: Appointment”

I run “process reminders” and also php /openemr/modules/sms_email_reminder/cron_email_notification.php

The text with the variables DATE, an PROVIDER …, etc … I don’t know what happens with it

@luisuriarte can you post what your Rule Detail looks like?

I already created my own rule which is why I suggested it but I still get nothing :frowning_face:

Looking at your due dates it seems to only work if it’s past due :thinking:

Also how did you get the interval to show up mine looks like this:

Thanks.

Hello. He was able to advance something. I have reviewed many scripts, but I can’t find the use of PROVIDER, DATE, STARTTIME, ENDTIME variables, just this NAME … I don’t understand how this works. Could someone use these variables?


Thank you.
luis

I’ve still haven’t gotten an appointment reminder working so you’re far ahead of me :man_shrugging:

You can check here. Years ago we had a PR that lay dormant so finally deleted that branch. But you can also put together texts tied to various reminders in html format. Standard code currently send this email that is like a sms and looks unprofessional.

Thanks for that but what we really want to know is how to set it up so it works in Open EMR like what exactly needs to be configured/happen in order for the system send an email when an appointment is made in the calendar and it sends an email reminder a day before the appointment date if that makes sense.

Thanks.

It has been long time but have you ensured your system is able to send email from cron using Example #1 Sending mail? Once you get that email working, you need to replace that php script by xxx/openemr/modules/sms_email_reminder/cron_email_notification.php in that job.

Now you narrowed problem to message selection logic in the script and actual sendmail process in the ealier link.

You can test by running the script in cli mode.

Email sending works fine it’s figuring out the facility rules in order to get an appointment email reminder that has me and everyone else confused. There’s no clear directions on how to get that working.

Thanks.

HI @benmarte,
First let me say I do not know how Reminders work either in openemr, which lead to building MedEx. You are welcome of course to use MedEx as Reminders are one of the things it does, but you may prefer to roll your own.

If you decide to take the “build it” route, You can find the queries to build reminders based on appt time, provider, facility appt status and appt type in the file library/MedEx/API.php, class Events, function generate. Attach it to a cron command and you are off.

However I would urge you to take a look at the new API features in > 6.0.0. Really transformative work. I think these REST/Smart on FHIR interfaces will serve as a basis to build out anything you want. I am looking to rebuild MedEx and will need to add to the functionality of these APIs, but the future there is bright…

There is another very powerful tool for reminders already in OpenEMR in the Clinical Reminders tool. There is a PR that simplifies this section of OpenEMR so clinicians users can understand what it can do, without sacrificing its ability to build super powerful functions. It needs work.

One of the many things it includes the ability to build reminders for ANYTHING. That part needs to be integrated into a Reminders backend. With a little more work, it will be able to marry outgoing messaging features right in OpenEMR to build anything you want: dietary programs, smoking cessation programs etc. It is not 6.0.1 but 5.01-2 probably.

Hi !!!@brady.miller @benmarte @luisuriarte

Has anyone managed to get appointment reminders to work, etc? I have version 6.0.0(3) in xampp with win and mercury. In 5.0.2(5) despite @arnabnaha 's tutorial I have not succeeded.
Greetings.

Hi !!! @benmarte @brady.miller @sjpadgett @luisuriarte
Has anyone been able to get email reminders to work?

Thanks

I did it…
I was finally able to send appointment reminder emails to patients.
Update the cron_email_notification.php and cron_functions.php scripts that are in openemr/modules/sms_email_reminder/.
Use the phpMailer class.
I couldn’t run it via cron: php ./cron_email_notification.php (error: Invalid URLRequest with site id ‘’ contains invalid characters., on Windows same error).
It only runs fine from the browser: http://localhost/openemr/modules/sms_email_reminder/cron_email_notification.php
Update openemr_postcalendar_events table (pc_appstatus = MAIL and pcsendalertmail = YES) and insert log into notification_log table.
Only 2 questions
1- How do I make it work with cron?
2- How to decrypt $GLOBALS[‘SMTP_PASS’] to use it with phpMailer: $mail->Password = $GLOBALS[‘SMTP_PASS’]; ?

Full directory attached.
Thank you very much.
Regards.
Luis.
sms_email_reminder.7z (93.9 KB)

1 Like