Skip to content

Commit

Permalink
Use the admin user as the envelope sender (to catch bounces etc)
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Jul 27, 2003
1 parent e561d3c commit 2b97bd7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 {
Expand Down

0 comments on commit 2b97bd7

Please sign in to comment.