Email setup

(system) #1

docaltmed wrote on Monday, January 11, 2010:

The email wiki refers to several parameters in the globals.php file that need to be modified, specifically:

    $GLOBALS - email outgoing server host/ip
    $GLOBALS - email outgoing server port
    $GLOBALS - if to use ssl
    $GLOBALS - local host name used to send email
    $GLOBALS - outgoing server user
    $GLOBALS - outgoing server password

In searching the forums, there seemed to be one post which suggested that the globals.php file had been modified to reflect the wiki instructions, but I’m not seeing it. I am using 3.1 with patch #5 installed.

What is the correct format for adding these parameters? Should I just, for example, add:

$GLOBALS (as well as the other lines) to the bottom of the globals.php file? ( being my smtp server)

thanks in advance for the help,


(system) #2

wooyi wrote on Monday, January 11, 2010:

To add variables for the smtp:
$GLOBALS = ‘’;
$GLOBALS = ‘25’;
$GLOBALS = ‘’;
$GLOBALS = ‘password’;

I am looking at this feature at the moment because I’m integrating an automatic phone reminder service to OpenEMR using a similar approach to the email reminders.

I did not find the Admin interface for the Notifications as described in the Wiki, but you can configure this by manually updating the automatic_notification table in the database to update the sender’s email and the email message title, body you want sent out. I got it to work after I updated this table.

(system) #3

docaltmed wrote on Tuesday, January 12, 2010:

Thanks for your help! I modified globals.php. Now I’m getting an error message that there is trouble communicating with the email server. I’ll look at ports and firewalls first, before I try anything esoteric.

(system) #4

wooyi wrote on Tuesday, January 12, 2010:

If it’s not your firewall, it could be your ISPs. ISPs routinely close port 25 to avoid people sending out spam. You can use telnet to test your connection:

telnet 25

(system) #5

docaltmed wrote on Tuesday, January 12, 2010:

Another good call, wooyi. port was locked off, so I checked with my host, found I could use port 587. That worked with telnet, but I’m still getting the same response from OpenEMR. It looks like this:

xl(‘Could not send email due to a server problem, ‘,’’,’
). 5 . xl(’ emails not sent’,’’,’’,’

(system) #6

aperezcrespo wrote on Tuesday, January 12, 2010:


If using gmail (587 is common for them) you need to import their certficate.  Try this How to for sending email through GMAIL.  I have used it to send email via the command line or scripts.


(system) #7

wooyi wrote on Wednesday, January 13, 2010:

btw, after looking at the cron scripts in the sms_email_reminder module and there are some significant bugs in there. The function that queries for appointments from the calender, for example, is not correct and will result in weird behavior. It does not calculate the “forward” date correctly.

(system) #8

mdsupport wrote on Wednesday, April 20, 2011:

Recently upgraded one practice to 4.0 which broke the email process.  Here is the Cron Daemon’s message when running cron_email_notification.php :

Warning: include_once(…/…/interface/globals.php): failed to open stream: No such file or directory in /var/www/openemr/modules/sms_email_reminder/cron_email_notification.php on line 18

Warning: include_once(): Failed opening ‘…/…/interface/globals.php’ for inclusion (include_path=’.:/usr/share/php:/usr/share/pear’) in /var/www/openemr/modules/sms_email_reminder/cron_email_notification.php on line 18

Fatal error: Call to undefined function sqlFetchArray() in /var/www/openemr/modules/sms_email_reminder/cron_functions.php on line 349

Is there a patch / fix or did we miss a configuration step?


(system) #9

vambati wrote on Sunday, April 29, 2012:


I am trying to make cron_email_notification.php working,

when i run it command line like
php /var/www/openemr/modules/sms_email_reminder/cron_email_notification.php -e

I am getting this error

PHP Notice:  Undefined index: HTTP_HOST in /var/www/openemr/interface/globals.php on line 127
Site ID ‘’ contains invalid characters.

can you tell me if you faced such problem if so how did you fix it.

I am running openemr 4.1.0 (9) on ubuntu.

Thank you

(system) #10

bradymiller wrote on Tuesday, May 01, 2012:


This is an issue I have noted when trying to do command line scripts within OpenEMR since the multisite feature was added. Will need to either bring in the site parameter into this script (either as a parameter or hard-code it) and set it equal to $_SESSION near the beginning (before the call to globals.php) of the script.


(system) #11

lourui wrote on Thursday, August 16, 2012:

has anyone figured out the fix for the email not working after upgrade to 4.1 ?

(system) #12

bradymiller wrote on Saturday, August 18, 2012:

Somebody needs to incorporate the fix outlined in above post (post 10) to get these scripts to work when called via command line. Bringing the site_id in as a parameter seems like the best way.

(system) #13

lourui wrote on Saturday, August 18, 2012:

Thank you for the reply Brady …

(system) #14

bradymiller wrote on Saturday, August 18, 2012:


To provide a bit more details, try placing the following code above the include_once("…/…/interface/globals.php"); line:
$_GET = ‘default’;

This will hard-code the site in. Note it will break if using multisite module or if using something other than default at openemr/sites/* . The proper way to do this (so it works in both command line mode and php mode) is to collect a parameter (and only if the parameter exists, then set it to that).


(system) #15

lourui wrote on Tuesday, August 21, 2012:

Thank you Brady for pointing me in the right direction. My email is now working :slight_smile:

(Gerardo) #16

could you help me fix it please? because i followed all indication and still receive the same error “PHP Notice: Undefined index: HTTP_HOST in /var/www/html/openemr/interface/globals.php on line 107
Site ID ‘’ contains invalid characters.”
and it doesn’t send any emails to remembers appointment patients, here is the log problem but i don’t know which code i put inside to fix it.