MDL-48080 email: Do not send to .invalid addresses. It is an invalid TLD

This commit is contained in:
pau.ferrer-ocana 2014-12-16 10:17:52 +01:00 committed by crazyserver
parent f1c4e3d2ba
commit 90e30644d5

View File

@ -5809,6 +5809,13 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml = '',
return false;
}
// TLD .invalid is specifically reserved for invalid domain names.
// For More information, see {@link http://tools.ietf.org/html/rfc2606#section-2}.
if (substr($user->email, -8) == '.invalid') {
debugging("email_to_user: User $user->id (".fullname($user).") email domain ($user->email) is invalid! Not sending.");
return true; // This is not an error.
}
// If the user is a remote mnet user, parse the email text for URL to the
// wwwroot and modify the url to direct the user's browser to login at their
// home site (identity provider - idp) before hitting the link itself.