Commit 1bdf899e authored by Marius Burkard's avatar Marius Burkard

Merge branch '5896-quota-notification-emails' into 'develop'

fix quota notification mail

Closes #5907 and #5896

See merge request !1314
parents aee0071e 7adc9b3f
Pipeline #6420 passed with stage
in 19 seconds
......@@ -824,8 +824,7 @@ class ispcmail {
else $rec_string .= $recip;
}
$to = $this->_encodeHeader($rec_string, $this->mail_charset);
//$result = mail($to, $subject, $this->body, implode($this->_crlf, $headers));
$result = mail($to, $enc_subject, $this->body, implode($this->_crlf, $headers));
$result = mail($to, $enc_subject, $this->body, implode($this->_crlf, $headers), "-f $this->_mail_sender");
}
// Reset the subject in case mail is resent
......
......@@ -812,7 +812,7 @@ class monitor_tools {
}
public function send_notification_email($template, $placeholders, $recipients) {
global $conf;
global $app, $conf;
if(!is_array($recipients) || count($recipients) < 1) return false;
if(!is_array($placeholders)) $placeholders = array();
......@@ -829,6 +829,7 @@ class monitor_tools {
//* get mail headers, subject and body
$mailHeaders = '';
$mailFrom = '';
$mailBody = '';
$mailSubject = '';
$inHeader = true;
......@@ -844,6 +845,16 @@ class monitor_tools {
$mailSubject = trim($parts[1]);
continue;
}
if(strtolower($parts[0]) == 'From') {
$mailFrom = trim($parts[1]);
continue;
}
if(strtolower($parts[0]) == 'Cc') {
if (! in_array(trim($parts[1]), $recipients)) {
$recipients[] = trim($parts[1]);
}
continue;
}
unset($parts);
$mailHeaders .= trim($lines[$l]) . "\n";
} else {
......@@ -854,18 +865,14 @@ class monitor_tools {
//* Replace placeholders
$mailHeaders = strtr($mailHeaders, $placeholders);
$mailFrom = strtr($mailFrom, $placeholders);
$mailSubject = strtr($mailSubject, $placeholders);
$mailBody = strtr($mailBody, $placeholders);
for($r = 0; $r < count($recipients); $r++) {
$app->functions->mail($recipients[$r], $mailSubject, $mailBody, $mailHeaders);
$app->functions->mail($recipients[$r], $mailSubject, $mailBody, $mailFrom);
}
unset($mailSubject);
unset($mailHeaders);
unset($mailBody);
unset($lines);
return true;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment