from address in settings can be forced

This commit is contained in:
Uwe Steinmann 2024-09-17 20:29:19 +02:00
parent ad37593625
commit f2ab106a81

View File

@ -50,7 +50,7 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
protected $debug;
function __construct($dms, $from_address='', $smtp_server='', $smtp_port='', $smtp_username='', $smtp_password='', $lazy_ssl=true) { /* {{{ */
function __construct($dms, $from_address='', $smtp_server='', $smtp_port='', $smtp_username='', $smtp_password='', $lazy_ssl=true, $force_from=false) { /* {{{ */
$this->_dms = $dms;
$this->smtp_server = $smtp_server;
$this->smtp_port = $smtp_port;
@ -58,6 +58,7 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
$this->smtp_password = $smtp_password;
$this->from_address = $from_address;
$this->lazy_ssl = $lazy_ssl;
$this->force_from = $force_from;
$this->debug = false;
} /* }}} */
@ -101,7 +102,9 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
return false;
$returnpath = $this->from_address;
if(is_object($sender) && !strcasecmp(get_class($sender), $this->_dms->getClassname('user'))) {
if($this->force_from && $this->from_address) {
$from = $this->from_address;
} elseif(is_object($sender) && !strcasecmp(get_class($sender), $this->_dms->getClassname('user'))) {
$from = $sender->getFullName() ." <". $sender->getEmail() .">";
if(!$returnpath)
$returnpath = $sender->getEmail();