From 9f58537a539fcd1d370a05fbfccefe2cbb4b9c16 Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 5 Nov 2002 06:06:18 +0000 Subject: [PATCH] Added SMTP authentication for email delivery --- admin/config.html | 17 +++++++++++++++++ lang/en/moodle.php | 1 + lib/defaults.php | 2 ++ lib/moodlelib.php | 6 ++++++ version.php | 4 ++-- 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/admin/config.html b/admin/config.html index 89a8496924..9b1642c04c 100644 --- a/admin/config.html +++ b/admin/config.html @@ -62,6 +62,23 @@ + +

smtpuser: + + + + + + + + + +

smtppass: + + + + +

gdversion: diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 2a76c8074a..45561973ba 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -63,6 +63,7 @@ $string['configmaxeditingtime'] = "This specifies the amount of time people have $string['configproxyhost'] = "If this server 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."; diff --git a/lib/defaults.php b/lib/defaults.php index 602d2125bd..f42d2f138a 100644 --- a/lib/defaults.php +++ b/lib/defaults.php @@ -10,6 +10,8 @@ "locale" => "en", "auth" => "email", "smtphosts" => "", + "smtpuser" => "", + "smtppass" => "", "gdversion" => 1, "longtimenosee" => 100, "zip" => "/usr/bin/zip", diff --git a/lib/moodlelib.php b/lib/moodlelib.php index d3f8fd77e7..10038882fc 100644 --- a/lib/moodlelib.php +++ b/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 } diff --git a/version.php b/version.php index ce1b735c23..858e6a3248 100644 --- a/version.php +++ b/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 -- 2.39.5