Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added SMTP authentication for email delivery

  • Loading branch information...
commit 9f58537a539fcd1d370a05fbfccefe2cbb4b9c16 1 parent 54e90f2
moodler authored
View
17 admin/config.html
@@ -63,6 +63,23 @@
</TD>
</TR>
<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>smtpuser:</TD>
+ <TD>
+ <INPUT NAME=smtpuser TYPE=text SIZE=10 VALUE="<?=$config->smtpuser?>">
+ <? formerr($err["smtpuser"]); ?>
+ </TD>
+ <TD ROWSPAN=2>
+ <? print_string("configsmtpuser") ?>
+ </TD>
+</TR>
+<TR VALIGN=TOP>
+ <TD ALIGN=RIGHT><P>smtppass:</TD>
+ <TD>
+ <INPUT NAME=smtppass TYPE=text SIZE=10 VALUE="<?=$config->smtppass?>">
+ <? formerr($err["smtppass"]); ?>
+ </TD>
+</TR>
+<TR VALIGN=TOP>
<TD ALIGN=RIGHT><P>gdversion:</TD>
<TD>
<? unset($options);
View
1  lang/en/moodle.php
@@ -63,6 +63,7 @@
$string['configproxyhost'] = "If this <B>server</B> needs to use a proxy computer (eg a firewall) to access the Internet, then provide the proxy hostname and port here. Otherwise leave it blank.";
$string['configslasharguments'] = "Files (images, uploads etc) are provided via a script using 'slash arguments' (the second option here). This method allows files to be more easily cached in web browsers, proxy servers etc. Unfortunately, some PHP servers don't allow this method, so if you have trouble viewing uploaded files or images (eg user pictures), set this variable to the first option";
$string['configsmtphosts'] = "Give the full name of one or more local SMTP servers that Moodle should use to send mail (eg 'mail.a.com' or 'mail.a.com;mail.b.com'). If you leave it blank, Moodle will use the PHP default method of sending mail.";
+$string['configsmtpuser'] = "If you have specified an SMTP server above, and the server requires authentication, then enter the username and password here.";
$string['configunzip'] = "Indicate the location of your unzip program (Unix only). This is needed to unpack zip archives on the server.";
$string['configvariables'] = "Configure variables";
$string['configzip'] = "Indicate the location of your zip program (Unix only). This is needed to create zip archives on the server.";
View
2  lib/defaults.php
@@ -10,6 +10,8 @@
"locale" => "en",
"auth" => "email",
"smtphosts" => "",
+ "smtpuser" => "",
+ "smtppass" => "",
"gdversion" => 1,
"longtimenosee" => 100,
"zip" => "/usr/bin/zip",
View
6 lib/moodlelib.php
@@ -1527,6 +1527,12 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml="", $a
if ($CFG->smtphosts) {
$mail->IsSMTP(); // use SMTP directly
$mail->Host = "$CFG->smtphosts"; // specify main and backup servers
+
+ if ($CFG->smtpuser) { // Use SMTP authentication
+ $mail->SMTPAuth = true;
+ $mail->Username = $CFG->smtpuser;
+ $mail->Password = $CFG->smtppass;
+ }
} else {
$mail->IsMail(); // use PHP mail() = sendmail
}
View
4 version.php
@@ -5,7 +5,7 @@
// database to determine whether upgrades should
// be performed (see lib/db/*.php)
-$version = 2002103000; // The current version is a date (YYYYMMDDXX)
+$version = 2002110500; // The current version is a date (YYYYMMDDXX)
-$release = "1.0.6 +"; // User-friendly version number
+$release = "1.0.7 dev"; // User-friendly version number
Please sign in to comment.
Something went wrong with that request. Please try again.