From 744db7c9e5fc89d227c1beb981d01898ce478e41 Mon Sep 17 00:00:00 2001 From: David Flatz Date: Fri, 29 Jul 2022 14:18:56 +0200 Subject: improve validation and escaping of e-mail addresses: use same method for validation in check_email and address_error; encode and validate IDNs; make (more) robust functions to split address lists and emails --- test/it_mail.t | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/it_mail.t b/test/it_mail.t index 7e892c2..6aefd84 100755 --- a/test/it_mail.t +++ b/test/it_mail.t @@ -56,6 +56,12 @@ is( "Don't remove quoting characters from realname when it contains a quotable character" ); +is( + $mail->addrlist_escape('"Alfred E. Neuman" ', true), + '"Alfred E. Neuman" ', + "Convert domain in email to idn version" +); + $mail = new it_mail([ 'From' => 'Someone Ïmportant <ïmportant@search.ch>', 'To' => 'éxample@example.com, example@example.com, Sömeone Ëlse , "Alfred E. Neuman" , "Schmitt, Sören" ', @@ -95,10 +101,23 @@ is( ); is( - it_mail::address_error('neuman@example.com, , "Neuman, Alfred E." , aneuman, "" ', " neumann@example.com"), + it_mail::address_error('neuman@example.com, , "Neuman, Alfred E." , aneuman, "" , " neumann@example.com", "www@search.ch".foo.bar@local.ch, test@sör.ch'), null, "Accept valid e-mail addresses" ); -foreach (['neuman@example', '"neuman@example.com" ', '', '