Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

If $CFG->smtphosts is empty, then mailer uses PHP mail() == sendmail.

  • Loading branch information...
commit 7f86ce17bace28ff51e8b1e438221a562c32b651 1 parent 5710022
martin authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/moodlelib.php
View
8 lib/moodlelib.php
@@ -909,8 +909,12 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml="", $a
$mail->Version = "Moodle"; // mailer version
$mail->PluginDir = "$CFG->libdir/phpmailer/"; // plugin directory (eg smtp plugin)
- $mail->IsSMTP(); // set mailer to use SMTP
- $mail->Host = "$CFG->smtphosts"; // specify main and backup servers
+ if ($CFG->smtphosts) {
+ $mail->IsSMTP(); // use SMTP directly
+ $mail->Host = "$CFG->smtphosts"; // specify main and backup servers
+ } else {
+ $mail->IsMail(); // use PHP mail() = sendmail
+ }
$mail->From = "$from->email";
$mail->FromName = "$from->firstname $from->lastname";
Please sign in to comment.
Something went wrong with that request. Please try again.