From ffa02ae4d0b2b2f6e8239f48e309ee992fba1e3f Mon Sep 17 00:00:00 2001
From: Urban Müller
Date: Mon, 14 Mar 2022 14:05:43 +0100
Subject: accept naked unix user names as recipients

---
 it_mail.class | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/it_mail.class b/it_mail.class
index 6394e5f..ab75ffc 100644
--- a/it_mail.class
+++ b/it_mail.class
@@ -408,9 +408,11 @@ static function send_smtp_cmd($fp, $cmd, &$answer, $timeoutok = false, $failcode
 
 /* Return errors found with email address, null otherwise
  */
-static function address_error($email)
+static function address_error($emails)
 {
-	return it::match(self::$addr_regex, $email) ? null : "invalid format";
+	foreach (it::split(',\s*', $emails) as $email)
+		if (!it::match(self::$addr_regex, $email) && !it::match('^[a-z][-a-z0-9]*$', $email))
+			return "invalid format";
 }
 
 
@@ -528,5 +530,3 @@ static function check_email($email, $checkmailbox = false)
 }
 
 }
-
-?>
-- 
cgit v1.2.3