summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/private/Mail/Mailer.php4
-rw-r--r--tests/lib/Mail/MailerTest.php1
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php
index f8dc739428a..2e996dea502 100644
--- a/lib/private/Mail/Mailer.php
+++ b/lib/private/Mail/Mailer.php
@@ -221,6 +221,10 @@ class Mailer implements IMailer {
* @return bool True if the mail address is valid, false otherwise
*/
public function validateMailAddress(string $email): bool {
+ if ($email === '') {
+ // Shortcut: empty addresses are never valid
+ return false;
+ }
$validator = new EmailValidator();
$validation = new RFCValidation();
diff --git a/tests/lib/Mail/MailerTest.php b/tests/lib/Mail/MailerTest.php
index 3ec2e96dfab..a11a1ab0914 100644
--- a/tests/lib/Mail/MailerTest.php
+++ b/tests/lib/Mail/MailerTest.php
@@ -178,6 +178,7 @@ class MailerTest extends TestCase {
['lukas@192.168.1.1', true],
['lukas@éxämplè.com', true],
['asdf', false],
+ ['', false],
['lukas@owncloud.org@owncloud.com', false],
];
}