mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
MDL-44467 lib: Fix return path to noreply.
Added code to show emails from users on controlled domains. Moved admin settings from message_email to admin.
This commit is contained in:
parent
253ae23058
commit
9715f61a26
@ -69,6 +69,17 @@ if ($hassiteconfig) {
|
||||
$plugin->load_settings($ADMIN, 'blocksettings', $hassiteconfig);
|
||||
}
|
||||
|
||||
// message outputs
|
||||
$ADMIN->add('modules', new admin_category('messageoutputs', new lang_string('messageoutputs', 'message')));
|
||||
$ADMIN->add('messageoutputs', new admin_page_managemessageoutputs());
|
||||
$ADMIN->add('messageoutputs', new admin_page_defaultmessageoutputs());
|
||||
$plugins = core_plugin_manager::instance()->get_plugins_of_type('message');
|
||||
core_collator::asort_objects_by_property($plugins, 'displayname');
|
||||
foreach ($plugins as $plugin) {
|
||||
/** @var \core\plugininfo\message $plugin */
|
||||
$plugin->load_settings($ADMIN, 'messageoutputs', $hassiteconfig);
|
||||
}
|
||||
|
||||
// authentication plugins
|
||||
$ADMIN->add('modules', new admin_category('authsettings', new lang_string('authentication', 'admin')));
|
||||
|
||||
|
@ -214,17 +214,59 @@ $ADMIN->add('server', new admin_externalpage('adminregistration', new lang_strin
|
||||
"$CFG->wwwroot/$CFG->admin/registration/index.php"));
|
||||
|
||||
// E-mail settings.
|
||||
$ADMIN->add('server', new admin_category('email', new lang_string('categoryemail', 'message_email')));
|
||||
$ADMIN->add('email', new admin_category('outgoingmailconfig', new lang_string('outgoingmailconfig', 'message_email')));
|
||||
$ADMIN->add('outgoingmailconfig', new admin_page_managemessageoutputs());
|
||||
$ADMIN->add('outgoingmailconfig', new admin_page_defaultmessageoutputs());
|
||||
$plugins = core_plugin_manager::instance()->get_plugins_of_type('message');
|
||||
core_collator::asort_objects_by_property($plugins, 'displayname');
|
||||
foreach ($plugins as $plugin) {
|
||||
/** @var \core\plugininfo\message $plugin */
|
||||
$plugin->load_settings($ADMIN, 'outgoingmailconfig', $hassiteconfig);
|
||||
}
|
||||
|
||||
$ADMIN->add('server', new admin_category('email', new lang_string('categoryemail', 'admin')));
|
||||
|
||||
$temp = new admin_settingpage('outgoingmailconfig', new lang_string('outgoingmailconfig', 'admin'));
|
||||
|
||||
$temp->add(new admin_setting_heading('smtpheading', new lang_string('smtp', 'admin'),
|
||||
new lang_string('smtpdetail', 'admin')));
|
||||
$temp->add(new admin_setting_configtext('smtphosts', new lang_string('smtphosts', 'admin'),
|
||||
new lang_string('configsmtphosts', 'admin'), '', PARAM_RAW));
|
||||
$options = array('' => new lang_string('none', 'admin'), 'ssl' => 'SSL', 'tls' => 'TLS');
|
||||
$temp->add(new admin_setting_configselect('smtpsecure', new lang_string('smtpsecure', 'admin'),
|
||||
new lang_string('configsmtpsecure', 'admin'), '', $options));
|
||||
$authtypeoptions = array('LOGIN' => 'LOGIN', 'PLAIN' => 'PLAIN', 'NTLM' => 'NTLM', 'CRAM-MD5' => 'CRAM-MD5');
|
||||
$temp->add(new admin_setting_configselect('smtpauthtype', new lang_string('smtpauthtype', 'admin'),
|
||||
new lang_string('configsmtpauthtype', 'admin'), 'LOGIN', $authtypeoptions));
|
||||
$temp->add(new admin_setting_configtext('smtpuser', new lang_string('smtpuser', 'admin'),
|
||||
new lang_string('configsmtpuser', 'admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configpasswordunmask('smtppass', new lang_string('smtppass', 'admin'),
|
||||
new lang_string('configsmtpuser', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configtext('smtpmaxbulk', new lang_string('smtpmaxbulk', 'admin'),
|
||||
new lang_string('configsmtpmaxbulk', 'admin'), 1, PARAM_INT));
|
||||
$temp->add(new admin_setting_heading('noreplydomainheading', new lang_string('noreplydomain', 'admin'),
|
||||
new lang_string('noreplydomaindetail', 'admin')));
|
||||
$temp->add(new admin_setting_configtext('noreplyaddress', new lang_string('noreplyaddress', 'admin'),
|
||||
new lang_string('confignoreplyaddress', 'admin'), 'noreply@' . get_host_from_url($CFG->wwwroot), PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtextarea('allowedemaildomains',
|
||||
new lang_string('allowedemaildomains', 'admin'),
|
||||
new lang_string('configallowedemaildomains', 'admin'),
|
||||
''));
|
||||
$temp->add(new admin_setting_heading('emaildoesnotfit', new lang_string('doesnotfit', 'admin'),
|
||||
new lang_string('doesnotfitdetail', 'admin')));
|
||||
$charsets = get_list_of_charsets();
|
||||
unset($charsets['UTF-8']); // Not needed here.
|
||||
$options = array();
|
||||
$options['0'] = 'UTF-8';
|
||||
$options = array_merge($options, $charsets);
|
||||
$temp->add(new admin_setting_configselect('sitemailcharset', new lang_string('sitemailcharset', 'admin'),
|
||||
new lang_string('configsitemailcharset','admin'), '0', $options));
|
||||
$temp->add(new admin_setting_configcheckbox('allowusermailcharset', new lang_string('allowusermailcharset', 'admin'),
|
||||
new lang_string('configallowusermailcharset', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowattachments', new lang_string('allowattachments', 'admin'),
|
||||
new lang_string('configallowattachments', 'admin'), 1));
|
||||
$options = array('LF' => 'LF', 'CRLF' => 'CRLF');
|
||||
$temp->add(new admin_setting_configselect('mailnewline', new lang_string('mailnewline', 'admin'),
|
||||
new lang_string('configmailnewline', 'admin'), 'LF', $options));
|
||||
|
||||
$choices = array(new lang_string('never', 'admin'),
|
||||
new lang_string('always', 'admin'),
|
||||
new lang_string('onlynoreply', 'admin'));
|
||||
$temp->add(new admin_setting_configselect('emailfromvia', new lang_string('emailfromvia', 'admin'),
|
||||
new lang_string('configemailfromvia', 'admin'), 1, $choices));
|
||||
|
||||
$ADMIN->add('email', $temp);
|
||||
|
||||
// "update notifications" settingpage
|
||||
if (empty($CFG->disableupdatenotifications)) {
|
||||
$temp = new admin_settingpage('updatenotifications', new lang_string('updatenotifications', 'core_admin'));
|
||||
|
@ -25,10 +25,9 @@
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
if ($hassiteconfig) {
|
||||
$category = new admin_category('messageinbound', new lang_string('incomingmailconfiguration', 'tool_messageinbound'));
|
||||
|
||||
// Create a settings page for all of the mail server settings.
|
||||
$settings = new admin_settingpage('messageinbound_mailsettings', new lang_string('mailsettings', 'tool_messageinbound'));
|
||||
$settings = new admin_settingpage('messageinbound_mailsettings',
|
||||
new lang_string('incomingmailconfiguration', 'tool_messageinbound'));
|
||||
|
||||
$settings->add(new admin_setting_heading('messageinbound_generalconfiguration',
|
||||
new lang_string('messageinboundgeneralconfiguration', 'tool_messageinbound'),
|
||||
@ -75,13 +74,10 @@ if ($hassiteconfig) {
|
||||
new lang_string('messageinboundhostpass', 'tool_messageinbound'),
|
||||
new lang_string('messageinboundhostpass_desc', 'tool_messageinbound'), ''));
|
||||
|
||||
$category->add('messageinbound', $settings);
|
||||
|
||||
// Add the category to the admin tree.
|
||||
$ADMIN->add('email', $settings);
|
||||
// Link to the external page for Inbound Message handler configuration.
|
||||
$category->add('messageinbound', new admin_externalpage('messageinbound_handlers',
|
||||
$ADMIN->add('email', new admin_externalpage('messageinbound_handlers',
|
||||
new lang_string('message_handlers', 'tool_messageinbound'),
|
||||
"$CFG->wwwroot/$CFG->admin/tool/messageinbound/index.php"));
|
||||
|
||||
// Add the category to the admin tree.
|
||||
$ADMIN->add('email', $category);
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ $string['allowuserswitchrolestheycantassign'] = 'Allow users without the assign
|
||||
$string['allowuserthemes'] = 'Allow user themes';
|
||||
$string['alternativefullnameformat'] = 'Alternative full name format';
|
||||
$string['alternativefullnameformat_desc'] = 'This defines how names are shown to users with the viewfullnames capability (by default users with the role of manager, teacher or non-editing teacher). Placeholders that can be used are as for the "Full name format" setting.';
|
||||
$string['always'] = 'Always';
|
||||
$string['appearance'] = 'Appearance';
|
||||
$string['aspellpath'] = 'Path to aspell';
|
||||
$string['authentication'] = 'Authentication';
|
||||
@ -198,6 +199,7 @@ $string['configdoctonewwindow'] = 'If you enable this, then links to Moodle Docs
|
||||
$string['configeditordictionary'] = 'This value will be used if aspell doesn\'t have dictionary for users own language.';
|
||||
$string['configeditorfontlist'] = 'Select the fonts that should appear in the editor\'s drop-down list.';
|
||||
$string['configemailchangeconfirmation'] = 'Require an email confirmation step when users change their email address in their profile.';
|
||||
$string['configemailfromvia'] = 'Add via information in the "From" section of outgoing email. This informs the recipient from where this email came from and also helps combat recipients accidentally replying to no-reply email addresses.';
|
||||
$string['configenablecalendarexport'] = 'Enable exporting or subscribing to calendars.';
|
||||
$string['configenablecomments'] = 'Enable comments';
|
||||
$string['configenablecourserequests'] = 'This will allow any user to request a course be created.';
|
||||
@ -444,6 +446,7 @@ $string['editorspelling'] = 'Editor spelling';
|
||||
$string['editorspellinghelp'] = 'Enable or disable spell-checking. When enabled, <strong>aspell</strong> must be installed on the server.';
|
||||
$string['editstrings'] = 'Edit words or phrases';
|
||||
$string['emailchangeconfirmation'] = 'Email change confirmation';
|
||||
$string['emailfromvia'] = 'Email via information';
|
||||
$string['emoticontext'] = 'Text';
|
||||
$string['emoticonimagename'] = 'Image name';
|
||||
$string['emoticonalt'] = 'Alternative text';
|
||||
@ -748,6 +751,7 @@ $string['navshowmycoursecategories'] = 'Show my course categories';
|
||||
$string['navshowmycoursecategories_help'] = 'If enabled courses in the users my courses branch will be shown in categories.';
|
||||
$string['navsortmycoursessort'] = 'Sort my courses';
|
||||
$string['navsortmycoursessort_help'] = 'This determines whether courses are listed under My courses according to the sort order (i.e. the order set in Site administration > Courses > Manage courses and categories) or alphabetically by course setting.';
|
||||
$string['never'] = 'Never';
|
||||
$string['neverdeleteruns'] = 'Never delete runs';
|
||||
$string['newestdocindexed'] = 'Newest document indexed';
|
||||
$string['nobookmarksforuser'] = 'You do not have any bookmarks.';
|
||||
@ -767,6 +771,7 @@ $string['notifyloginthreshold'] = 'Threshold for email notifications';
|
||||
$string['notloggedinroleid'] = 'Role for visitors';
|
||||
$string['numberofmissingstrings'] = 'Number of missing strings: {$a}';
|
||||
$string['numberofstrings'] = 'Total number of strings: {$a->strings}<br />Missing: {$a->missing} ({$a->missingpercent} %)';
|
||||
$string['onlynoreply'] = 'Only when from a no-reply address';
|
||||
$string['opcacherecommended'] = 'PHP opcode caching improves performance and lowers memory requirements, OPcache extension is recommended and fully supported.';
|
||||
$string['opensslrecommended'] = 'Installing the optional OpenSSL library is highly recommended -- it enables Moodle Networking functionality.';
|
||||
$string['opentogoogle'] = 'Open to Google';
|
||||
|
@ -705,6 +705,7 @@ $string['emailresetconfirmsent'] = 'An email has been sent to your address at <b
|
||||
If you continue to have difficulty, contact the site administrator.';
|
||||
$string['emailtoprivatefiles'] = 'You can also e-mail files as attachments straight to your private files space. Simply attach your files to an e-mail and send it to {$a}';
|
||||
$string['emailtoprivatefilesdenied'] = 'Your administrator has disabled the option to upload your own private files.';
|
||||
$string['emailvia'] = '{$a->name} via {$a->url}';
|
||||
$string['emptydragdropregion'] = 'empty region';
|
||||
$string['enable'] = 'Enable';
|
||||
$string['encryptedcode'] = 'Encrypted code';
|
||||
|
@ -762,7 +762,8 @@ function login_lock_account($user) {
|
||||
$oldforcelang = force_current_language($user->lang);
|
||||
|
||||
$site = get_site();
|
||||
$noreplyuser = core_user::get_noreply_user();
|
||||
$supportuser = core_user::get_support_user();
|
||||
|
||||
$data = new stdClass();
|
||||
$data->firstname = $user->firstname;
|
||||
$data->lastname = $user->lastname;
|
||||
@ -776,7 +777,7 @@ function login_lock_account($user) {
|
||||
|
||||
if ($message) {
|
||||
// Directly email rather than using the messaging system to ensure its not routed to a popup or jabber.
|
||||
email_to_user($user, $noreplyuser, $subject, $message);
|
||||
email_to_user($user, $supportuser, $subject, $message);
|
||||
}
|
||||
|
||||
force_current_language($oldforcelang);
|
||||
|
@ -43,6 +43,21 @@ class core_user {
|
||||
*/
|
||||
const SUPPORT_USER = -20;
|
||||
|
||||
/**
|
||||
* Hide email address from everyone.
|
||||
*/
|
||||
const MAILDISPLAY_HIDE = 0;
|
||||
|
||||
/**
|
||||
* Display email address to everyone.
|
||||
*/
|
||||
const MAILDISPLAY_EVERYONE = 1;
|
||||
|
||||
/**
|
||||
* Display email address to course members only.
|
||||
*/
|
||||
const MAILDISPLAY_COURSE_MEMBERS_ONLY = 2;
|
||||
|
||||
/** @var stdClass keep record of noreply user */
|
||||
public static $noreplyuser = false;
|
||||
|
||||
|
@ -2299,5 +2299,13 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2016101401.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2016102700.01) {
|
||||
// Remove unused admin email setting.
|
||||
unset_config('emailonlyfromreplyaddress');
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2016102700.01);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -520,6 +520,21 @@ define('COURSE_DISPLAY_MULTIPAGE', 1);
|
||||
*/
|
||||
define('AUTH_PASSWORD_NOT_CACHED', 'not cached');
|
||||
|
||||
/**
|
||||
* Email from header to never include via information.
|
||||
*/
|
||||
define('EMAIL_VIA_NEVER', 0);
|
||||
|
||||
/**
|
||||
* Email from header to always include via information.
|
||||
*/
|
||||
define('EMAIL_VIA_ALWAYS', 1);
|
||||
|
||||
/**
|
||||
* Email from header to only include via information if the address is no-reply.
|
||||
*/
|
||||
define('EMAIL_VIA_NO_REPLY_ONLY', 2);
|
||||
|
||||
// PARAMETER HANDLING.
|
||||
|
||||
/**
|
||||
@ -5685,13 +5700,6 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml = '',
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check from address and prevent emails to be sent from support email address.
|
||||
$supportuser = core_user::get_support_user();
|
||||
if ($from->email == $supportuser->email) {
|
||||
debugging('Support user email address should not be used for email sending.', DEBUG_NORMAL);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (email_should_be_diverted($user->email)) {
|
||||
$subject = "[DIVERTED {$user->email}] $subject";
|
||||
$user = clone($user);
|
||||
@ -5746,38 +5754,58 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml = '',
|
||||
$temprecipients = array();
|
||||
$tempreplyto = array();
|
||||
|
||||
// Make sure that we fall back onto some reasonable no-reply address.
|
||||
$noreplyaddress = empty($CFG->noreplyaddress) ? 'noreply@' . get_host_from_url($CFG->wwwroot) : $CFG->noreplyaddress;
|
||||
|
||||
// Make up an email address for handling bounces.
|
||||
if (!empty($CFG->handlebounces)) {
|
||||
$modargs = 'B'.base64_encode(pack('V', $user->id)).substr(md5($user->email), 0, 16);
|
||||
$mail->Sender = generate_email_processing_address(0, $modargs);
|
||||
} else {
|
||||
$mail->Sender = $CFG->noreplyaddress;
|
||||
$mail->Sender = $noreplyaddress;
|
||||
}
|
||||
|
||||
$alloweddomains = null;
|
||||
if (!empty($CFG->allowedemaildomains)) {
|
||||
$alloweddomains = explode(PHP_EOL, $CFG->allowedemaildomains);
|
||||
}
|
||||
|
||||
// Email will be sent using no reply address.
|
||||
if ($CFG->emailonlyfromnoreplyaddress == true) {
|
||||
if (empty($alloweddomains)) {
|
||||
$usetrueaddress = false;
|
||||
if (empty($replyto) && $from->maildisplay) {
|
||||
$replyto = $from->email;
|
||||
$replytoname = fullname($from);
|
||||
}
|
||||
} else {
|
||||
// Use user's email address (if allowed).
|
||||
$usetrueaddress = true;
|
||||
}
|
||||
|
||||
if (is_string($from)) { // So we can pass whatever we want if there is need.
|
||||
$mail->From = $CFG->noreplyaddress;
|
||||
$mail->From = $noreplyaddress;
|
||||
$mail->FromName = $from;
|
||||
} else if ($usetrueaddress and $from->maildisplay) {
|
||||
// If noreplyaddress is set to false, use users email address as from address.
|
||||
$mail->From = $from->email;
|
||||
$mail->FromName = fullname($from);
|
||||
} else {
|
||||
$mail->From = $CFG->noreplyaddress;
|
||||
$mail->FromName = fullname($from);
|
||||
// Check if using the true address is true, and the email is in the list of allowed domains for sending email,
|
||||
// and that the senders email setting is either displayed to everyone, or display to only other users that are enrolled
|
||||
// in a course with the sender.
|
||||
} else if ($usetrueaddress && can_send_from_real_email_address($from, $user, $alloweddomains)) {
|
||||
$mail->From = $from->email;
|
||||
$fromdetails = new stdClass();
|
||||
$fromdetails->name = fullname($from);
|
||||
$fromdetails->url = $CFG->wwwroot;
|
||||
$fromstring = $fromdetails->name;
|
||||
if ($CFG->emailfromvia == EMAIL_VIA_ALWAYS) {
|
||||
$fromstring = get_string('emailvia', 'core', $fromdetails);
|
||||
}
|
||||
$mail->FromName = $fromstring;
|
||||
if (empty($replyto)) {
|
||||
$tempreplyto[] = array($CFG->noreplyaddress, get_string('noreplyname'));
|
||||
$tempreplyto[] = array($from->email, fullname($from));
|
||||
}
|
||||
} else {
|
||||
$mail->From = $noreplyaddress;
|
||||
$fromdetails = new stdClass();
|
||||
$fromdetails->name = fullname($from);
|
||||
$fromdetails->url = $CFG->wwwroot;
|
||||
$fromstring = $fromdetails->name;
|
||||
if ($CFG->emailfromvia != EMAIL_VIA_NEVER) {
|
||||
$fromstring = get_string('emailvia', 'core', $fromdetails);
|
||||
}
|
||||
$mail->FromName = $fromstring;
|
||||
if (empty($replyto)) {
|
||||
$tempreplyto[] = array($noreplyaddress, get_string('noreplyname'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -5977,6 +6005,27 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml = '',
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if a user's real email address should be used for the "From" field.
|
||||
*
|
||||
* @param object $from The user object for the user we are sending the email from.
|
||||
* @param object $user The user object that we are sending the email to.
|
||||
* @param array $alloweddomains An array of allowed domains that we can send email from.
|
||||
* @return bool Returns true if we can use the from user's email adress in the "From" field.
|
||||
*/
|
||||
function can_send_from_real_email_address($from, $user, $alloweddomains) {
|
||||
// Email is in the list of allowed domains for sending email,
|
||||
// and the senders email setting is either displayed to everyone, or display to only other users that are enrolled
|
||||
// in a course with the sender.
|
||||
if (\core\ip_utils::is_domain_in_allowed_list(substr($from->email, strpos($from->email, '@') + 1), $alloweddomains)
|
||||
&& ($from->maildisplay == core_user::MAILDISPLAY_EVERYONE
|
||||
|| ($from->maildisplay == core_user::MAILDISPLAY_COURSE_MEMBERS_ONLY
|
||||
&& enrol_get_shared_courses($user, $from, false, true)))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a signoff for emails based on support settings
|
||||
*
|
||||
@ -6015,7 +6064,7 @@ function setnew_password_and_mail($user, $fasthash = false) {
|
||||
|
||||
$site = get_site();
|
||||
|
||||
$noreplyuser = core_user::get_noreply_user();
|
||||
$supportuser = core_user::get_support_user();
|
||||
|
||||
$newpassword = generate_password();
|
||||
|
||||
@ -6034,7 +6083,7 @@ function setnew_password_and_mail($user, $fasthash = false) {
|
||||
$subject = format_string($site->fullname) .': '. (string)new lang_string('newusernewpasswordsubj', '', $a, $lang);
|
||||
|
||||
// Directly email rather than using the messaging system to ensure its not routed to a popup or jabber.
|
||||
return email_to_user($user, $noreplyuser, $subject, $message);
|
||||
return email_to_user($user, $supportuser, $subject, $message);
|
||||
|
||||
}
|
||||
|
||||
@ -6048,7 +6097,7 @@ function reset_password_and_mail($user) {
|
||||
global $CFG;
|
||||
|
||||
$site = get_site();
|
||||
$noreplyuser = core_user::get_noreply_user();
|
||||
$supportuser = core_user::get_support_user();
|
||||
|
||||
$userauth = get_auth_plugin($user->auth);
|
||||
if (!$userauth->can_reset_password() or !is_enabled_auth($user->auth)) {
|
||||
@ -6078,7 +6127,7 @@ function reset_password_and_mail($user) {
|
||||
unset_user_preference('create_password', $user); // Prevent cron from generating the password.
|
||||
|
||||
// Directly email rather than using the messaging system to ensure its not routed to a popup or jabber.
|
||||
return email_to_user($user, $noreplyuser, $subject, $message);
|
||||
return email_to_user($user, $supportuser, $subject, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -6091,7 +6140,7 @@ function send_confirmation_email($user) {
|
||||
global $CFG;
|
||||
|
||||
$site = get_site();
|
||||
$noreplyuser = core_user::get_noreply_user();
|
||||
$supportuser = core_user::get_support_user();
|
||||
|
||||
$data = new stdClass();
|
||||
$data->firstname = fullname($user);
|
||||
@ -6109,7 +6158,7 @@ function send_confirmation_email($user) {
|
||||
$user->mailformat = 1; // Always send HTML version as well.
|
||||
|
||||
// Directly email rather than using the messaging system to ensure its not routed to a popup or jabber.
|
||||
return email_to_user($user, $noreplyuser, $subject, $message, $messagehtml);
|
||||
return email_to_user($user, $supportuser, $subject, $message, $messagehtml);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -6123,7 +6172,7 @@ function send_password_change_confirmation_email($user, $resetrecord) {
|
||||
global $CFG;
|
||||
|
||||
$site = get_site();
|
||||
$noreplyuser = core_user::get_noreply_user();
|
||||
$supportuser = core_user::get_support_user();
|
||||
$pwresetmins = isset($CFG->pwresettime) ? floor($CFG->pwresettime / MINSECS) : 30;
|
||||
|
||||
$data = new stdClass();
|
||||
@ -6139,7 +6188,7 @@ function send_password_change_confirmation_email($user, $resetrecord) {
|
||||
$subject = get_string('emailresetconfirmationsubject', '', format_string($site->fullname));
|
||||
|
||||
// Directly email rather than using the messaging system to ensure its not routed to a popup or jabber.
|
||||
return email_to_user($user, $noreplyuser, $subject, $message);
|
||||
return email_to_user($user, $supportuser, $subject, $message);
|
||||
|
||||
}
|
||||
|
||||
@ -6153,7 +6202,7 @@ function send_password_change_info($user) {
|
||||
global $CFG;
|
||||
|
||||
$site = get_site();
|
||||
$noreplyuser = core_user::get_noreply_user();
|
||||
$supportuser = core_user::get_support_user();
|
||||
$systemcontext = context_system::instance();
|
||||
|
||||
$data = new stdClass();
|
||||
@ -6168,7 +6217,7 @@ function send_password_change_info($user) {
|
||||
$message = get_string('emailpasswordchangeinfodisabled', '', $data);
|
||||
$subject = get_string('emailpasswordchangeinfosubject', '', format_string($site->fullname));
|
||||
// Directly email rather than using the messaging system to ensure its not routed to a popup or jabber.
|
||||
return email_to_user($user, $noreplyuser, $subject, $message);
|
||||
return email_to_user($user, $supportuser, $subject, $message);
|
||||
}
|
||||
|
||||
if ($userauth->can_change_password() and $userauth->change_password_url()) {
|
||||
@ -6189,7 +6238,7 @@ function send_password_change_info($user) {
|
||||
}
|
||||
|
||||
// Directly email rather than using the messaging system to ensure its not routed to a popup or jabber.
|
||||
return email_to_user($user, $noreplyuser, $subject, $message);
|
||||
return email_to_user($user, $supportuser, $subject, $message);
|
||||
|
||||
}
|
||||
|
||||
|
@ -23,34 +23,38 @@
|
||||
*/
|
||||
|
||||
$string['allowattachments'] = 'Allow attachments';
|
||||
$string['allowedemaildomains'] = 'Allowed email domains';
|
||||
$string['allowusermailcharset'] = 'Allow user to select character set';
|
||||
$string['categoryemail'] = 'E-mail';
|
||||
$string['configallowattachments'] = 'If enabled, emails sent from the site can have attachments, such as badges.';
|
||||
$string['configallowedemaildomains'] = 'List email domains that are allowed to be disclosed in the "From" section of outgoing email. The default of "Empty" will use the No-reply address for all outgoing email. The use of wildcards is allowed e.g. *.example.com will allow emails sent from any subdomain of example.com, but not example.com itself. This will require separate entry.';
|
||||
$string['configallowusermailcharset'] = 'If enabled, users can choose an email charset in their messaging preferences.';
|
||||
$string['configmaildomain'] = 'This setting specifies a trusted email domain that will be used to detect spoofing, handle bouncing and validate users emails.';
|
||||
$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['configemailonlyfromnoreplyaddress'] = 'By default all email will be sent using the no-reply address as the "from" address or emails can sent using users email address if allowed. This can be used to stop anti-spoofing controls in external mail systems blocking emails.';
|
||||
$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). This setting will also be used as the envelope sender when sending email.';
|
||||
$string['configsitemailcharset'] = 'This setting specifies the default charset for all emails sent from the site.';
|
||||
$string['configsmtpauthtype'] = 'This sets the authentication type to use on smtp server.';
|
||||
$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['doesnotfit'] = 'Does not fit elsewhere';
|
||||
$string['doesnotfitdetail'] = 'Email settings that do not fit in another category.';
|
||||
$string['email'] = 'Send email notifications to';
|
||||
$string['emailonlyfromnoreplyaddress'] = 'Always send email from the no-reply address?';
|
||||
$string['ifemailleftempty'] = 'Leave empty to send notifications to {$a}';
|
||||
$string['mailnewline'] = 'Newline characters in mail';
|
||||
$string['none'] = 'None';
|
||||
$string['noreplyaddress'] = 'No-reply address';
|
||||
$string['noreplydomain'] = 'No-reply and domain';
|
||||
$string['noreplydomaindetail'] = 'Settings for No-reply and configured domains';
|
||||
$string['outgoingmailconfig'] = 'Outgoing mail configuration';
|
||||
$string['pluginname'] = 'Email';
|
||||
$string['sitemailcharset'] = 'Character set';
|
||||
$string['smtp'] = 'SMTP';
|
||||
$string['smtpauthtype'] = 'SMTP Auth Type';
|
||||
$string['sendusinguseremail'] = 'Use user email address (if allowed)';
|
||||
$string['smtpdetail'] = 'Settings directly related to SMTP.';
|
||||
$string['smtphosts'] = 'SMTP hosts';
|
||||
$string['smtpmaxbulk'] = 'SMTP session limit';
|
||||
$string['smtppass'] = 'SMTP password';
|
||||
$string['smtpsecure'] = 'SMTP security';
|
||||
$string['smtpuser'] = 'SMTP username';
|
||||
$string['maildomain'] = 'Mail domain';
|
||||
|
@ -1,53 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Email configuration page
|
||||
*
|
||||
* @package message_email
|
||||
* @copyright 2011 Lancaster University Network Services Limited
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
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));
|
||||
$authtypeoptions = array('LOGIN' => 'LOGIN', 'PLAIN' => 'PLAIN', 'NTLM' => 'NTLM', 'CRAM-MD5' => 'CRAM-MD5');
|
||||
$settings->add(new admin_setting_configselect('smtpauthtype', get_string('smtpauthtype', 'message_email'), get_string('configsmtpauthtype', 'message_email'), 'LOGIN', $authtypeoptions));
|
||||
$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));
|
||||
$settings->add(new admin_setting_configtext('noreplyaddress', get_string('noreplyaddress', 'message_email'), get_string('confignoreplyaddress', 'message_email'), 'noreply@' . get_host_from_url($CFG->wwwroot), PARAM_NOTAGS));
|
||||
$sendemailoptions = array(0 => get_string('sendusinguseremail', 'message_email'), 1 => get_string('yes'));
|
||||
$settings->add(new admin_setting_configselect('emailonlyfromnoreplyaddress',
|
||||
get_string('emailonlyfromnoreplyaddress', 'message_email'),
|
||||
get_string('configemailonlyfromnoreplyaddress', 'message_email'),
|
||||
1, $sendemailoptions));
|
||||
$settings->add(new admin_setting_configtext('maildomain', get_string('maildomain', 'message_email'), get_string('configmaildomain', 'message_email'), '', PARAM_RAW));
|
||||
$charsets = get_list_of_charsets();
|
||||
unset($charsets['UTF-8']); // not needed here
|
||||
$options = array();
|
||||
$options['0'] = 'UTF-8';
|
||||
$options = array_merge($options, $charsets);
|
||||
$settings->add(new admin_setting_configselect('sitemailcharset', get_string('sitemailcharset', 'message_email'), get_string('configsitemailcharset','message_email'), '0', $options));
|
||||
$settings->add(new admin_setting_configcheckbox('allowusermailcharset', get_string('allowusermailcharset', 'message_email'), get_string('configallowusermailcharset', 'message_email'), 0));
|
||||
$settings->add(new admin_setting_configcheckbox('allowattachments', get_string('allowattachments', 'message_email'), get_string('configallowattachments', 'message_email'), 1));
|
||||
$options = array('LF'=>'LF', 'CRLF'=>'CRLF');
|
||||
$settings->add(new admin_setting_configselect('mailnewline', get_string('mailnewline', 'message_email'), get_string('configmailnewline','message_email'), 'LF', $options));
|
||||
}
|
@ -853,11 +853,6 @@ function forum_cron() {
|
||||
$eventdata->set_additional_content('email', $additionalcontent);
|
||||
}
|
||||
|
||||
// If replytouser is not set then send mail using the noreplyaddress.
|
||||
if (empty($CFG->noreplyaddress)) {
|
||||
$eventdata->userfrom = core_user::get_noreply_user();
|
||||
}
|
||||
|
||||
$smallmessagestrings = new stdClass();
|
||||
$smallmessagestrings->user = fullname($userfrom);
|
||||
$smallmessagestrings->forumname = "$shortname: " . format_string($forum->name, true) . ": " . $discussion->name;
|
||||
|
@ -2,7 +2,7 @@ This files describes API changes in /mod/forum/*,
|
||||
information provided here is intended especially for developers.
|
||||
|
||||
=== 3.2 ===
|
||||
* The setting $CFG->forum_replytouser has been deprecated in favour of a centralized noreplyaddress setting.
|
||||
* The setting $CFG->forum_replytouser has been removed in favour of a centralized noreplyaddress setting.
|
||||
Please use $CFG->noreplyaddress setting instead.
|
||||
* The following functions have been finally deprecated and should no longer be used.
|
||||
- forum_count_unrated_posts
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2016102700.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2016102700.01; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user