From 2b97bd71e36778cf3203f53416c5902d71f304d1 Mon Sep 17 00:00:00 2001 From: moodler Date: Sun, 27 Jul 2003 13:14:00 +0000 Subject: [PATCH] Use the admin user as the envelope sender (to catch bounces etc) --- lib/moodlelib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index e5d1ba510a..2ed83d6ba2 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -705,6 +705,10 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml="", $a $mail->IsMail(); // use PHP mail() = sendmail } + $adminuser = get_admin(); + + $mail->Sender = "$adminuser->email"; + $mail->From = "$from->email"; $mail->FromName = "$from->firstname $from->lastname"; $mail->Subject = stripslashes($subject); @@ -724,7 +728,6 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml="", $a if ($attachment && $attachname) { if (ereg( "\\.\\." ,$attachment )) { // Security check for ".." in dir path - $adminuser = get_admin(); $mail->AddAddress("$adminuser->email", "$adminuser->firstname $adminuser->lastname"); $mail->AddStringAttachment("Error in attachment. User attempted to attach a filename with a unsafe name.", "error.txt", "8bit", "text/plain"); } else { -- 2.39.5