aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Mail/Mailer.php
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-05-29 19:07:28 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2024-05-31 14:18:06 +0200
commit1a273145304601d98383d18848331ab6335a63f2 (patch)
tree018126afd9d25e6d9381ea24750265a193e708a2 /lib/private/Mail/Mailer.php
parent4a6ac1f1aab769089b1b48a45bbb15bd1fb847e1 (diff)
downloadnextcloud-server-1a273145304601d98383d18848331ab6335a63f2.tar.gz
nextcloud-server-1a273145304601d98383d18848331ab6335a63f2.zip
fix(Mailer): Allow to enforce strict email format
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'lib/private/Mail/Mailer.php')
-rw-r--r--lib/private/Mail/Mailer.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php
index 041ab8b0ff7..e866cbfdbbc 100644
--- a/lib/private/Mail/Mailer.php
+++ b/lib/private/Mail/Mailer.php
@@ -9,6 +9,7 @@ declare(strict_types=1);
namespace OC\Mail;
use Egulias\EmailValidator\EmailValidator;
+use Egulias\EmailValidator\Validation\NoRFCWarningsValidation;
use Egulias\EmailValidator\Validation\RFCValidation;
use OCP\Defaults;
use OCP\EventDispatcher\IEventDispatcher;
@@ -206,8 +207,10 @@ class Mailer implements IMailer {
// Shortcut: empty addresses are never valid
return false;
}
+
+ $strictMailCheck = $this->config->getAppValue('core', 'enforce_strict_email_check', 'yes') === 'yes';
$validator = new EmailValidator();
- $validation = new RFCValidation();
+ $validation = $strictMailCheck ? new NoRFCWarningsValidation() : new RFCValidation();
return $validator->isValid($email, $validation);
}