Allow setting message type for send_mail
Hanno Böck

Hanno Böck commited on 2024-03-07 11:50:19
Zeige 1 geänderte Dateien mit 7 Einfügungen und 2 Löschungen.

... ...
@@ -446,12 +446,17 @@ function get_modules_info()
446 446
 }
447 447
 
448 448
 
449
-function send_mail($address, $subject, $body)
449
+function send_mail($address, $subject, $body, $msgtype = "adminmail")
450 450
 {
451 451
     if (strstr($subject, "\n") !== false) {
452 452
         die("Zeilenumbruch im subject!");
453 453
     }
454
-    $header = "From: " . config('company_name') . " Web Administration <" . config('adminmail') . ">\r\nCc: " . config('adminmail') . "\r\nContent-Type: text/plain; charset=\"utf-8\"\r\nContent-Transfer-Encoding: quoted-printable\r\nX-schokokeks-org-message: webinterface";
454
+    $header = "From: " . config('company_name') . " Web Administration <" . config('adminmail') . ">\r\n";
455
+    if ($address !== config('adminmail')) {
456
+        $header .= "Cc: " . config('adminmail') . "\r\n";
457
+    }
458
+    $header .= "X-schokokeks-org-message: " . $msgtype . "\r\n";
459
+    $header .= "Content-Type: text/plain; charset=\"utf-8\"\r\nContent-Transfer-Encoding: quoted-printable\r\n";
455 460
     $subject = mb_encode_mimeheader($subject, "utf-8", "Q");
456 461
     $body = quoted_printable_encode($body);
457 462
     mail($address, $subject, $body, $header);
458 463