Skip to content

Commit 1bdf899

Browse files
author
Marius Burkard
committed
Merge branch '5896-quota-notification-emails' into 'develop'
fix quota notification mail Closes #5907 and #5896 See merge request ispconfig/ispconfig3!1314
2 parents aee0071 + 7adc9b3 commit 1bdf899

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

server/lib/classes/ispcmail.inc.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -824,8 +824,7 @@ public function send($recipients) {
824824
else $rec_string .= $recip;
825825
}
826826
$to = $this->_encodeHeader($rec_string, $this->mail_charset);
827-
//$result = mail($to, $subject, $this->body, implode($this->_crlf, $headers));
828-
$result = mail($to, $enc_subject, $this->body, implode($this->_crlf, $headers));
827+
$result = mail($to, $enc_subject, $this->body, implode($this->_crlf, $headers), "-f $this->_mail_sender");
829828
}
830829

831830
// Reset the subject in case mail is resent

server/lib/classes/monitor_tools.inc.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ public function delOldRecords($type, $serverId) {
812812
}
813813

814814
public function send_notification_email($template, $placeholders, $recipients) {
815-
global $conf;
815+
global $app, $conf;
816816

817817
if(!is_array($recipients) || count($recipients) < 1) return false;
818818
if(!is_array($placeholders)) $placeholders = array();
@@ -829,6 +829,7 @@ public function send_notification_email($template, $placeholders, $recipients) {
829829

830830
//* get mail headers, subject and body
831831
$mailHeaders = '';
832+
$mailFrom = '';
832833
$mailBody = '';
833834
$mailSubject = '';
834835
$inHeader = true;
@@ -844,6 +845,16 @@ public function send_notification_email($template, $placeholders, $recipients) {
844845
$mailSubject = trim($parts[1]);
845846
continue;
846847
}
848+
if(strtolower($parts[0]) == 'From') {
849+
$mailFrom = trim($parts[1]);
850+
continue;
851+
}
852+
if(strtolower($parts[0]) == 'Cc') {
853+
if (! in_array(trim($parts[1]), $recipients)) {
854+
$recipients[] = trim($parts[1]);
855+
}
856+
continue;
857+
}
847858
unset($parts);
848859
$mailHeaders .= trim($lines[$l]) . "\n";
849860
} else {
@@ -854,18 +865,14 @@ public function send_notification_email($template, $placeholders, $recipients) {
854865

855866
//* Replace placeholders
856867
$mailHeaders = strtr($mailHeaders, $placeholders);
868+
$mailFrom = strtr($mailFrom, $placeholders);
857869
$mailSubject = strtr($mailSubject, $placeholders);
858870
$mailBody = strtr($mailBody, $placeholders);
859871

860872
for($r = 0; $r < count($recipients); $r++) {
861-
$app->functions->mail($recipients[$r], $mailSubject, $mailBody, $mailHeaders);
873+
$app->functions->mail($recipients[$r], $mailSubject, $mailBody, $mailFrom);
862874
}
863875

864-
unset($mailSubject);
865-
unset($mailHeaders);
866-
unset($mailBody);
867-
unset($lines);
868-
869876
return true;
870877
}
871878

0 commit comments

Comments
 (0)