$userfrom->customheaders[] = 'In-Reply-To: ' . $messageid;
// The message will be sent from the intended user.
- $eventdata->userfrom = \core_user::get_support_user();
+ $eventdata->userfrom = \core_user::get_noreply_user();
$eventdata->userto = $USER;
$eventdata->subject = $this->get_reply_subject($this->currentmessagedata->envelope->subject);
$eventdata->fullmessage = get_string('invalidrecipientdescription', 'tool_messageinbound', $this->currentmessagedata);
$eventdata->modulename = 'moodle';
$eventdata->component = 'enrol_paypal';
$eventdata->name = 'paypal_enrolment';
- $eventdata->userfrom = empty($teacher) ? core_user::get_support_user() : $teacher;
+ $eventdata->userfrom = empty($teacher) ? core_user::get_noreply_user() : $teacher;
$eventdata->userto = $user;
$eventdata->subject = get_string("enrolmentnew", 'enrol', $shortname);
$eventdata->fullmessage = get_string('welcometocoursetext', '', $a);
You have requested a change of your email address for your user account at {$a->site}. Please open the following URL in your browser in order to confirm this change.
+If you have any questions please contact support on: {$a->supportemail}
+
{$a->url}';
$string['emailupdatesuccess'] = 'Email address of user <em>{$a->fullname}</em> was successfully updated to <em>{$a->email}</em>.';
$string['emailupdatetitle'] = 'Confirmation of email update at {$a->site}';
$oldforcelang = force_current_language($user->lang);
$site = get_site();
- $supportuser = core_user::get_support_user();
-
+ $noreplyuser = core_user::get_noreply_user();
$data = new stdClass();
$data->firstname = $user->firstname;
$data->lastname = $user->lastname;
if ($message) {
// Directly email rather than using the messaging system to ensure its not routed to a popup or jabber.
- email_to_user($user, $supportuser, $subject, $message);
+ email_to_user($user, $noreplyuser, $subject, $message);
}
force_current_language($oldforcelang);
mtrace('Emailing admins about '. $count .' failed login attempts');
foreach ($recip as $admin) {
// Emailing the admins directly rather than putting these through the messaging system.
- email_to_user($admin, \core_user::get_support_user(), $subject, $body);
+ email_to_user($admin, \core_user::get_noreply_user(), $subject, $body);
}
}
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);
$temprecipients = array();
$tempreplyto = array();
- $supportuser = core_user::get_support_user();
-
// 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 = $supportuser->email;
+ $mail->Sender = $CFG->noreplyaddress;
}
- if (!empty($CFG->emailonlyfromnoreplyaddress)) {
+ // Email will be sent using no reply address.
+ if ($CFG->emailonlyfromnoreplyaddress == true) {
$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->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 {
$site = get_site();
- $supportuser = core_user::get_support_user();
+ $noreplyuser = core_user::get_noreply_user();
$newpassword = generate_password();
$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, $supportuser, $subject, $message);
+ return email_to_user($user, $noreplyuser, $subject, $message);
}
global $CFG;
$site = get_site();
- $supportuser = core_user::get_support_user();
+ $noreplyuser = core_user::get_noreply_user();
$userauth = get_auth_plugin($user->auth);
if (!$userauth->can_reset_password() or !is_enabled_auth($user->auth)) {
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, $supportuser, $subject, $message);
+ return email_to_user($user, $noreplyuser, $subject, $message);
}
/**
global $CFG;
$site = get_site();
- $supportuser = core_user::get_support_user();
+ $noreplyuser = core_user::get_noreply_user();
$data = new stdClass();
$data->firstname = fullname($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, $supportuser, $subject, $message, $messagehtml);
+ return email_to_user($user, $noreplyuser, $subject, $message, $messagehtml);
}
/**
global $CFG;
$site = get_site();
- $supportuser = core_user::get_support_user();
+ $noreplyuser = core_user::get_noreply_user();
$pwresetmins = isset($CFG->pwresettime) ? floor($CFG->pwresettime / MINSECS) : 30;
$data = new stdClass();
$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, $supportuser, $subject, $message);
+ return email_to_user($user, $noreplyuser, $subject, $message);
}
global $CFG;
$site = get_site();
- $supportuser = core_user::get_support_user();
+ $noreplyuser = core_user::get_noreply_user();
$systemcontext = context_system::instance();
$data = new stdClass();
$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, $supportuser, $subject, $message);
+ return email_to_user($user, $noreplyuser, $subject, $message);
}
if ($userauth->can_change_password() and $userauth->change_password_url()) {
}
// Directly email rather than using the messaging system to ensure its not routed to a popup or jabber.
- return email_to_user($user, $supportuser, $subject, $message);
+ return email_to_user($user, $noreplyuser, $subject, $message);
}
set_config($disableprovidersetting, 1, 'message');
$preferences = get_message_output_default_preferences();
$this->assertTrue($preferences->$disableprovidersetting == 1);
-
+ $noreplyuser = core_user::get_noreply_user();
$message = new stdClass();
$message->component = 'moodle';
$message->name = 'instantmessage';
- $message->userfrom = get_admin();
+ $message->userfrom = $noreplyuser->email;
$message->userto = $this->getDataGenerator()->create_user();;
$message->subject = 'message subject 1';
$message->fullmessage = 'message body';
// Noreply user being valid user.
core_user::reset_internal_users();
$CFG->noreplyuserid = $user3->id;
- $noreplyuser = core_user::get_noreply_user();
list($onlinecontacts, $offlinecontacts, $strangers) = message_get_contacts();
$this->assertCount(0, $onlinecontacts);
$this->assertCount(1, $offlinecontacts);
$eventdata->set_additional_content('email', $additionalcontent);
}
- // If forum_replytouser is not set then send mail using the noreplyaddress.
- if (empty($CFG->forum_replytouser)) {
+ // If replytouser is not set then send mail using the noreplyaddress.
+ if (empty($CFG->noreplyaddress)) {
$eventdata->userfrom = core_user::get_noreply_user();
}
$settings->add(new admin_setting_configselect('forum_displaymode', get_string('displaymode', 'forum'),
get_string('configdisplaymode', 'forum'), FORUM_MODE_NESTED, forum_get_layout_modes()));
- $settings->add(new admin_setting_configcheckbox('forum_replytouser', get_string('replytouser', 'forum'),
- get_string('configreplytouser', 'forum'), 1));
-
// Less non-HTML characters than this is short
$settings->add(new admin_setting_configtext('forum_shortpost', get_string('shortpost', 'forum'),
get_string('configshortpost', 'forum'), 300, PARAM_INT));
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.
+ Please use $CFG->noreplyaddress setting instead.
* The following functions have been finally deprecated and should no longer be used.
- forum_count_unrated_posts
- forum_tp_count_discussion_read_records
$tempuser = $DB->get_record('user', array('id' => $user->id), '*', MUST_EXIST);
$tempuser->email = $usernew->preference_newemail;
+ $supportuser = core_user::get_support_user();
+
$a = new stdClass();
$a->url = $CFG->wwwroot . '/user/emailupdate.php?key=' . $usernew->preference_newemailkey . '&id=' . $user->id;
$a->site = format_string($SITE->fullname, true, array('context' => context_course::instance(SITEID)));
$a->fullname = fullname($tempuser, true);
+ $a->supportemail = $supportuser->email;
$emailupdatemessage = get_string('emailupdatemessage', 'auth', $a);
$emailupdatetitle = get_string('emailupdatetitle', 'auth', $a);
// Email confirmation directly rather than using messaging so they will definitely get an email.
- $supportuser = core_user::get_support_user();
- if (!$mailresults = email_to_user($tempuser, $supportuser, $emailupdatetitle, $emailupdatemessage)) {
+ $noreplyuser = core_user::get_noreply_user();
+ if (!$mailresults = email_to_user($tempuser, $noreplyuser, $emailupdatetitle, $emailupdatemessage)) {
die("could not send email!");
}
}