MDL-11378 Add SMTP security protocol setting to email configuration

This commit is contained in:
Ruslan Kabalin 2012-03-13 14:13:06 +00:00
parent 23778a4dfa
commit 70ad827c6c
3 changed files with 8 additions and 2 deletions

View File

@ -5005,6 +5005,7 @@ function get_mailer($action='get') {
$mailer->SMTPDebug = true;
}
$mailer->Host = $CFG->smtphosts; // specify main and backup servers
$mailer->SMTPSecure = $CFG->smtpsecure; // specify secure connection protocol
$mailer->SMTPKeepAlive = $prevkeepalive; // use previous keepalive
if ($CFG->smtpuser) { // Use SMTP authentication

View File

@ -27,16 +27,19 @@ $string['configallowusermailcharset'] = 'Enabling this, every user in the site w
$string['configmailnewline'] = 'Newline characters used in mail messages. CRLF is required according to RFC 822bis, some mail servers do automatic conversion from LF to CRLF, other mail servers do incorrect conversion from CRLF to CRCRLF, yet others reject mails with bare LF (qmail for example). Try changing this setting if you are having problems with undelivered emails or double newlines.';
$string['confignoreplyaddress'] = 'Emails are sometimes sent out on behalf of a user (eg forum posts). The email address you specify here will be used as the "From" address in those cases when the recipients should not be able to reply directly to the user (eg when a user chooses to keep their address private).';
$string['configsitemailcharset'] = 'All the emails generated by your site will be sent in the charset specified here. Anyway, every individual user will be able to adjust it if the next setting is enabled.';
$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\'). To specify a non-default port (i.e other than port 25), you can use the [server]:[port] syntax (eg \'mail.a.com:587\'. If you leave it blank, Moodle will use the PHP default method of sending mail.';
$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\'). To specify a non-default port (i.e other than port 25), you can use the [server]:[port] syntax (eg \'mail.a.com:587\'). For secure connections, port 465 is usually used with SSL, port 587 is usually used with TLS, specify security protocol below if required. If you leave this field blank, Moodle will use the PHP default method of sending mail.';
$string['configsmtpmaxbulk'] = 'Maximum number of messages sent per SMTP session. Grouping messages may speed up the sending of emails. Values lower than 2 force creation of new SMTP session for each email.';
$string['configsmtpsecure'] = 'If smtp server requires secure connection, specify the correct protocol type.';
$string['configsmtpuser'] = 'If you have specified an SMTP server above, and the server requires authentication, then enter the username and password here.';
$string['email'] = 'Send email notifications to';
$string['ifemailleftempty'] = 'Leave empty to send notifications to {$a}';
$string['mailnewline'] = 'Newline characters in mail';
$string['none'] = 'None';
$string['noreplyaddress'] = 'No-reply address';
$string['pluginname'] = 'Email';
$string['sitemailcharset'] = 'Character set';
$string['smtphosts'] = 'SMTP hosts';
$string['smtpmaxbulk'] = 'SMTP session limit';
$string['smtppass'] = 'SMTP password';
$string['smtpuser'] = 'SMTP username';
$string['smtpsecure'] = 'SMTP security';
$string['smtpuser'] = 'SMTP username';

View File

@ -26,6 +26,8 @@ defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
$settings->add(new admin_setting_configtext('smtphosts', get_string('smtphosts', 'message_email'), get_string('configsmtphosts', 'message_email'), '', PARAM_RAW));
$options = array('' => get_string('none', 'message_email'), 'ssl' => 'SSL', 'tls' => 'TLS');
$settings->add(new admin_setting_configselect('smtpsecure', get_string('smtpsecure', 'message_email'), get_string('configsmtpsecure', 'message_email'), '', $options));
$settings->add(new admin_setting_configtext('smtpuser', get_string('smtpuser', 'message_email'), get_string('configsmtpuser', 'message_email'), '', PARAM_NOTAGS));
$settings->add(new admin_setting_configpasswordunmask('smtppass', get_string('smtppass', 'message_email'), get_string('configsmtpuser', 'message_email'), ''));
$settings->add(new admin_setting_configtext('smtpmaxbulk', get_string('smtpmaxbulk', 'message_email'), get_string('configsmtpmaxbulk', 'message_email'), 1, PARAM_INT));