]> git.mjollnir.org Git - moodle.git/commitdiff
Use the admin user as the envelope sender (to catch bounces etc)
authormoodler <moodler>
Sun, 27 Jul 2003 13:14:00 +0000 (13:14 +0000)
committermoodler <moodler>
Sun, 27 Jul 2003 13:14:00 +0000 (13:14 +0000)
lib/moodlelib.php

index e5d1ba510a74d56642fba6b657d1d405eba16a3f..2ed83d6ba27f14c214f3cfbf74f7954d80a1648a 100644 (file)
@@ -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 {