From 6fedb19490482be3bbf49d3d61332f7df02f6239 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Sun, 27 Sep 2020 10:34:10 +0200 Subject: [PATCH] header and footer of body can be skipped --- inc/inc.ClassEmailNotify.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/inc/inc.ClassEmailNotify.php b/inc/inc.ClassEmailNotify.php index 5980b6159..674043faa 100644 --- a/inc/inc.ClassEmailNotify.php +++ b/inc/inc.ClassEmailNotify.php @@ -76,10 +76,14 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify { * @param string $message key of string containing the body of the mail * @param array $params list of parameters which replaces placeholder in * the subject and body + * This may contain the special keys + * __lang__: use this language for the email + * __skip_header__: do not include the standard body header + * __skip_footer__: do not include the standard body footer * @param array $attachments list of attachments * @return false or -1 in case of error, otherwise true */ - function toIndividual($sender, $recipient, $subject, $message, $params=array(), $attachments=array()) { /* {{{ */ + function toIndividual($sender, $recipient, $subject, $messagekey, $params=array(), $attachments=array()) { /* {{{ */ if(is_object($recipient) && !strcasecmp(get_class($recipient), $this->_dms->getClassname('user')) && !$recipient->isDisabled() && $recipient->getEmail()!="") { $to = $recipient->getEmail(); $lang = $recipient->getLanguage(); @@ -107,8 +111,12 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify { } - $message = getMLText("email_header", $params, "", $lang)."\r\n\r\n".getMLText($message, $params, "", $lang); - $message .= "\r\n\r\n".getMLText("email_footer", $params, "", $lang); + $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); $mime = new Mail_mime(array('eol' => "\n"));