add support for sending html mails

This commit is contained in:
Uwe Steinmann 2021-02-21 11:50:42 +01:00
parent 2f2472f79f
commit 686a6b3ab7

View File

@ -114,17 +114,47 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
}
$message = '';
if(!isset($params['__skip_header__']) || !$params['__skip_header__'])
$message .= getMLText("email_header", $params, "", $lang)."\r\n\r\n";
$message .= getMLText($messagekey, $params, "", $lang);
if(!isset($params['__skip_footer__']) || !$params['__skip_footer__'])
$message .= "\r\n\r\n".getMLText("email_footer", $params, "", $lang);
$body = '';
if(!isset($params['__skip_header__']) || !$params['__skip_header__']) {
if(!isset($params['__header__']))
$body .= getMLText("email_header", $params, "", $lang)."\r\n\r\n";
elseif($params['__header__'])
$body .= getMLText($params['__header__'], $params, "", $lang)."\r\n\r\n";
}
if(!isset($params['__body__']))
$body .= $params['__body__'];
else
$body .= getMLText($messagekey, $params, "", $lang);
if(!isset($params['__skip_footer__']) || !$params['__skip_footer__']) {
if(!isset($params['__footer__']))
$body .= "\r\n\r\n".getMLText("email_footer", $params, "", $lang);
elseif($params['__footer__'])
$body .= "\r\n\r\n".getMLText($params['__footer__'], $params, "", $lang);
}
$bodyhtml = '';
if(!isset($params['__skip_header__']) || !$params['__skip_header__']) {
if(!isset($params['__header_html__']))
$body .= getMLText("email_header", $params, "", $lang)."\r\n\r\n";
elseif($params['__header_html__'])
$body .= getMLText($params['__header_html__'], $params, "", $lang)."\r\n\r\n";
}
if(!isset($params['__body_html__']))
$body .= $params['__body_html__'];
else
$body .= getMLText($messagekey.'_html', $params, "", $lang);
if(!isset($params['__skip_footer__']) || !$params['__skip_footer__']) {
if(!isset($params['__footer_html__']))
$body .= "\r\n\r\n".getMLText("email_footer", $params, "", $lang);
elseif($params['__footer_html__'])
$body .= "\r\n\r\n".getMLText($params['__footer_html__'], $params, "", $lang);
}
$mime = new Mail_mime(array('eol' => "\n"));
$mime->setTXTBody($message);
// $mime->setHTMLBody($bodyhtml);
$mime->setTXTBody($body);
if($bodyhtml)
$mime->setHTMLBody($bodyhtml);
if($attachments) {
foreach($attachments as $attachment) {