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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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).
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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.
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
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
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
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
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
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
Please, let's move to the most current version of PHP 5 with the CCHIT release….
-Tony
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
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?
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
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
Thanks Brady, sounds good.
Rod
www.sunsetsystems.com
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
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
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;
}
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
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.