set from_address as return path if set

This commit is contained in:
Uwe Steinmann 2017-05-02 20:52:40 +02:00
parent 4e883444f2
commit 53f646114a

View File

@ -75,10 +75,15 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
return -1; return -1;
} }
$returnpath = '';
if(is_object($sender) && !strcasecmp(get_class($sender), $this->_dms->getClassname('user'))) { if(is_object($sender) && !strcasecmp(get_class($sender), $this->_dms->getClassname('user'))) {
$from = $sender->getFullName() ." <". $sender->getEmail() .">"; $from = $sender->getFullName() ." <". $sender->getEmail() .">";
if($this->from_address)
$returnpath = $this->from_address;
} elseif(is_string($sender) && trim($sender) != "") { } elseif(is_string($sender) && trim($sender) != "") {
$from = $sender; $from = $sender;
if($this->from_address)
$returnpath = $this->from_address;
} else { } else {
$from = $this->from_address; $from = $this->from_address;
} }
@ -90,6 +95,8 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
$headers = array (); $headers = array ();
$headers['From'] = $from; $headers['From'] = $from;
if($returnpath)
$headers['Return-Path'] = $returnpath;
$headers['To'] = $recipient->getEmail(); $headers['To'] = $recipient->getEmail();
$preferences = array("input-charset" => "UTF-8", "output-charset" => "UTF-8"); $preferences = array("input-charset" => "UTF-8", "output-charset" => "UTF-8");
$encoded_subject = iconv_mime_encode("Subject", getMLText($subject, $params, "", $lang), $preferences); $encoded_subject = iconv_mime_encode("Subject", getMLText($subject, $params, "", $lang), $preferences);
@ -119,22 +126,6 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
} else { } else {
return true; return true;
} }
/*
$headers = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/plain; charset=utf-8";
$headers[] = "From: ". $from;
$lang = $recipient->getLanguage();
$message = getMLText("email_header", array(), "", $lang)."\r\n\r\n".getMLText($message, $params, "", $lang);
$message .= "\r\n\r\n".getMLText("email_footer", array(), "", $lang);
$subject = "=?UTF-8?B?".base64_encode(getMLText($subject, $params, "", $lang))."?=";
mail($recipient->getEmail(), $subject, $message, implode("\r\n", $headers));
return true;
*/
} /* }}} */ } /* }}} */
function toGroup($sender, $groupRecipient, $subject, $message, $params=array()) { /* {{{ */ function toGroup($sender, $groupRecipient, $subject, $message, $params=array()) { /* {{{ */