diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 0b86aa91c2d..423b554f868 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -883,7 +883,13 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml="", $a $mail->CharSet = get_string("thischarset"); } - if ($CFG->smtphosts) { + if ($CFG->smtphosts == "qmail") { + $mail->IsQmail(); // use Qmail system + + } else if (empty($CFG->smtphosts)) { + $mail->IsMail(); // use PHP mail() = sendmail + + } else { $mail->IsSMTP(); // use SMTP directly if ($CFG->debug > 7) { echo "
\n"; @@ -896,8 +902,6 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml="", $a $mail->Username = $CFG->smtpuser; $mail->Password = $CFG->smtppass; } - } else { - $mail->IsMail(); // use PHP mail() = sendmail } $adminuser = get_admin();