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;
}
$returnpath = '';
if(is_object($sender) && !strcasecmp(get_class($sender), $this->_dms->getClassname('user'))) {
$from = $sender->getFullName() ." <". $sender->getEmail() .">";
if($this->from_address)
$returnpath = $this->from_address;
} elseif(is_string($sender) && trim($sender) != "") {
$from = $sender;
if($this->from_address)
$returnpath = $this->from_address;
} else {
$from = $this->from_address;
}
@ -90,6 +95,8 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
$headers = array ();
$headers['From'] = $from;
if($returnpath)
$headers['Return-Path'] = $returnpath;
$headers['To'] = $recipient->getEmail();
$preferences = array("input-charset" => "UTF-8", "output-charset" => "UTF-8");
$encoded_subject = iconv_mime_encode("Subject", getMLText($subject, $params, "", $lang), $preferences);
@ -119,22 +126,6 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
} else {
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()) { /* {{{ */