Menu

OpenEMR Emailing Mechanism

Developers
2010-01-16
2013-04-06
  • Brady Miller

    Brady Miller - 2010-01-16

    Hey,

    Considering all of the different projects that are going on that involve emailing, I think we need to decide on a common email method/library to use that is hopefully cross-platform. One option is to use one that already exist, and there currently there are several email mechanisms throughout OpenEMR (i honestly do not know if any of these work):
    controllers/C_Prescription.class.php
    interface/drugs/drugs.inc.php
    interface/drugs/dispense_drug.php
    interface/batchcom/batchEmail.php
    modules/sms_email_reminder/cron_functions.php

    Or may be best just to use a new common php method/library/utility to ensure cross-platform compatibility.

    thoughts?

    -brady

     
  • Anonymous

    Anonymous - 2010-01-16

    Timely topic. We are currently working on patient reminders and email integration.

    1. First, I suggest we update the phpmailer class as found in \library\classes\class.phpmailer.php

    Current version:

    ////////////////////////////////////////////////////
    // PHPMailer - PHP email class
    //
    // Class for sending email using either
    // sendmail, PHP mail(), or SMTP.  Methods are
    // based upon the standard AspEmail™ classes.
    //
    // Copyright (C) 2001 - 2003  Brent R. Matzelle
    //
    // License: LGPL, see LICENSE
    ////////////////////////////////////////////////////

    /**
    * PHPMailer - PHP email transport class
    * @package PHPMailer
    * @author Brent R. Matzelle
    * @copyright 2001 - 2003 Brent R. Matzelle
    */

    There is a newer version at SF:

    *~ class.phpmailer.php
    .--------------------------------------------------.
    |  Software: PHPMailer - PHP email class                                    |
    |   Version: 2.3                                                            |
    |   Contact: via sourceforge.net support pages (also www.codeworxtech.com)  |
    |      Info: http://phpmailer.sourceforge.net                               |
    |   Support: http://sourceforge.net/projects/phpmailer/                     |
    | ------------------------------------------------- |
    |    Author: Andy Prevost (project admininistrator)                         |
    |    Author: Brent R. Matzelle (original founder)                           |
    | Copyright (C) 2004-2007, Andy Prevost. All Rights Reserved.               |
    | Copyright (C) 2001-2003, Brent R. Matzelle                                |
    | ------------------------------------------------- |
    |   License: Distributed under the Lesser General Public License (LGPL)     |
    |            http://www.gnu.org/copyleft/lesser.html                        |
    | This program is distributed in the hope that it will be useful - WITHOUT  |
    | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     |
    | FITNESS FOR A PARTICULAR PURPOSE.                                         |
    | ------------------------------------------------- |
    | We offer a number of paid services (www.codeworxtech.com):                |
    | - Web Hosting on highly optimized fast and secure servers                 |
    | - Technology Consulting                                                   |
    | - Oursourcing (highly qualified programmers and graphic designers)        |
    '--------------------------------------------------'

    /**
    * PHPMailer - PHP email transport class
    * NOTE: Designed for use with PHP version 5 and up
    * @package PHPMailer
    * @author Andy Prevost
    * @copyright 2004 - 2008 Andy Prevost
    */

    2. Second, we plan to have a mini sender admin section in Patient Reminders so that different provider names and email addresses can be attached to the reminders. For example, a patient reminder for Mary can be addressed from her PCP Dr. Morris.

    3. The email sending method seems to be the same (i.e. using the phpmailer class) for all the scripts. I'm not sure if we can or want to consolidate the batch cron job because each one is done for a different logic.

     
  • Rod Roark

    Rod Roark - 2010-01-16

    Since PEAR is now a dependency (for the backup feature), I'd suggest putting PEAR::Mail on the short list for this.  I've not used it but it looks promising.

    Rod
    www.sunsetsystems.com

     
  • Brady Miller

    Brady Miller - 2010-01-16

    Rod,
    Backup mechanism does not require Archive/Tar.php on linux boxes. Only requires Archive/Tar.php on windows boxes (which is automatically included in the XAMPP release).
    -brady

     
  • Rod Roark

    Rod Roark - 2010-01-16

    I'd not noticed that… backup.php does have 'include\_once("Archive/Tar.php")' which will generate a PHP warning message if it's not found.  Anyway I just wanted to mention the PEAR option.

    Rod
    www.sunsetsystems.com

     
  • Anonymous

    Anonymous - 2010-01-17

    Do you see any problem if we upgrade the phpmailer class from the current version to 5.1?

    We have used version 2.3 (released in 2008) for the past two years without any issue. This is for a different application that we build. Now the latest version is 5.1. We can test Clickatell to make sure that it works too. We already know how to use Clickatell (Email to SMS Gateway).

    More info about 5.1 can be found at: http://phpmailer.worxware.com/index.php?pg=phpmailer

     
  • Brady Miller

    Brady Miller - 2010-01-17

    hey,
    I think the new phpmailer class you bring up would officially end our support for php4.  If the new phpmailer class is worth it, perhaps it's time to let go of php4; i haven't tested code on php4 for a least 6 months now, so not even sure how compatible our current codebase is.
    -brady

     
  • Rod Roark

    Rod Roark - 2010-01-17

    Still compatible, I believe.  But I don't mind ditching PHP4 for 3.3 and beyond.  Does the new phpmailer have anything we want?

    Rod
    www.sunsetsystems.com

     
  • Tony McCormick

    Tony McCormick - 2010-01-17

    Please, let's move to the most current version of PHP 5 with the CCHIT release….
    -Tony

     
  • Brady Miller

    Brady Miller - 2010-01-26

    hey,
    I'm assuming new phpmailer will have bug fixes and more security, but not clear of added features. Thomas, since putting this in for patient reminders, is there a way to ensure it won't break other mechanisms that relied on the old version.
    -brady

     
  • Anonymous

    Anonymous - 2010-01-27

    Hi Brady,

    The only other place that uses phpmailer is Rx section. See the screenshot here: http://www.openmedsoftware.org/wiki/File:Email_in_Rx.png

    What is the purpose of emailing here?

     
  • Brady Miller

    Brady Miller - 2010-01-27

    hey,

    If that's the case, then perhaps we should just take the plunge to phpmailer 5.1, which is only compatible with php5+ ? Anybody not agree?

    -brady

     
  • Brady Miller

    Brady Miller - 2010-01-27

    hey,

    Ready to commit phpmailer_5.1 upgrade to SF cvs if everybody agrees. Below files were taken from Thomas's Patient Reminder code(only mod I made was re-organizing the globals.php file and changing the default smtp port in globals.php to 25):
    openemr/library/classes/class.smtp.php
    openemr/library/classes/postmaster.php
    openemr/interface/globals.php
    openemr/library/phpmailer.lang-en.php
    openemr/library/classes/class.phpmailer.php

    -brady

     
  • Rod Roark

    Rod Roark - 2010-01-27

    Thanks Brady, sounds good.

    Rod
    www.sunsetsystems.com

     
  • Brady Miller

    Brady Miller - 2010-01-27

    hey,

    The deed is done. Put a summary of the new emailing mechanism here:
    http://www.openmedsoftware.org/wiki/Sending_Email

    Thomas, I pulled the example from your code. I'm confused, though, shouldn't these not be there (since defined in globals.php and class.postmaster.php):
    $mail->Host = "localhost";
    $mail->Mailer = "mail";

    -brady

     
  • Brady Miller

    Brady Miller - 2010-01-29

    hey,
    Should the default mailing mechanism in globals.php be  'mail' instead of 'smtp'. Seems like 'mail' may not require a local mail server??
    -brady

     
  • Anonymous

    Anonymous - 2010-01-29

    Hi Brady,

    We put SMTP and other variables in globals.php because they need to be configured by users. Postmaster.php is a file that we wrote to manage the configurations.

    "PHPMAIL" is used to make it clear that the email sending method is PHP default mail function (http://php.net/manual/en/function.mail.php).

    You can see it from the codes here:

            switch($EMAIL_METHOD)
            {
                case "PHPMAIL" :
                {
                    $this->Mailer = "mail";
                }
                break;
                case "SMTP" :
                {
    global $SMTP_Auth, $SMTP_HOST, $SMTP_USER, $SMTP_PASS, $SMTP_PORT;
                    $this->Mailer = "smtp";
                    $this->SMTPAuth = $SMTP_Auth;
                    $this->Host = $SMTP_HOST;
                    $this->Username = $SMTP_USER;
                    $this->Password = $SMTP_PASS;
                    $this->Port = $SMTP_PORT;
                }
                break;
                case "SENDMAIL" :
                {
                    $this->Mailer = "sendmail";
                }
                break;
            }

     
  • Brady Miller

    Brady Miller - 2010-01-29

    Thomas,
    I'm aware of this. Just trying to decide what the best default value should be for a new installation is all. Should it be PHPMAIL vs. SMTP vs SENDMAIL .
    Any thoughts on ideal setting for default?
    -brady

     
  • Anonymous

    Anonymous - 2010-01-29

    I don't think it matters much. If the server is set up for email use, then all the methods can be used. SMTP is better for sending bulk emails, while PHP Mail requires slightly less effort to set up and use.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.