How do appointment reminders work?

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

Go look at my fax module: oe-module-faxsms/rc_sms_notification.php at master · openemr/oe-module-faxsms · GitHub
It’s setup for cron jobs and will prob give a clue how to do.

Thank you very much for your answer Jerry. please where can i see the class “OpenEMR\Modules\FaxSMS\Controllers\AppDispatch”

That class is part of the fax module using Twilio SMS and Ring Central fax/sms. It won’t help with your project.
This is important part:

_SERVER['REQUEST_URI'] = $_SERVER['PHP_SELF'];
$_SERVER['SERVER_NAME'] = 'localhost';
$backpic = "";

// for cron
if ($argc > 1 && empty($_SESSION['site_id']) && empty($_GET['site'])) {
    $c = stripos($argv[1], 'site=');
    if ($c === false) {
        echo xlt("Missing Site Id using default") . "\n";
        $argv[1] = "site=default";
    }
    $args = explode('=', $argv[1]);
    $_GET['site'] = isset($args[1]) ? $args[1] : 'default';
}
if (php_sapi_name() === 'cli') {
    $_SERVER[‘HTTP_HOST’] = ‘localhost’;
    $ignoreAuth = true;
}
require_once(__DIR__ . "/../../../globals.php");
require_once("$srcdir/appointments.inc.php");

It shows how to call from command line for cron. Note
To decrypt password look here around L-47: library/classes/postmaster.php

Well, it’s finished. The script works for both cron and windows (task scheduler). I have tested it on Rocky Linux 8.5 and Windows 11 (xampp), both with php 8.1. The logs are recorded in openemr/modules/sms_email_reminder/logs (I think you have to create the logs folder). Thank you very much @sjpadgett.
It only works for sending emails. It’s just 2 scripts that need to replace and read the readme.txt file. I hope it serves you.
Regards.
Luis.

cron_email_notification.php (4.2 KB)
cron_functions.php (14.1 KB)
readme.txt (429 Bytes)

2 Likes

@luisuriarte Thanks for posting this. I’m going to look over to see if I can’t get it into core then bring back for next 6.1 patch so you don’t have to worry with keeping up with a custom script.