From 66a0c9f49176ec3309b94ea232fbbd92735454ae Mon Sep 17 00:00:00 2001 From: David Flatz Date: Fri, 5 Feb 2016 12:12:07 +0100 Subject: use php function to escape headers; don't swallow double quotes when escaping, this should fix bounces when realname contains umlauts and komma; be a little pedantic about whitespace in addrlist --- tests/it_mail.t | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'tests/it_mail.t') diff --git a/tests/it_mail.t b/tests/it_mail.t index 687480c..41ca3d1 100755 --- a/tests/it_mail.t +++ b/tests/it_mail.t @@ -20,7 +20,7 @@ is( is( $mail->addrlist_escape('Èxample User <èxample@example.com>', true), - '=?utf-8?Q?=C3=88xample_User?= <èxample@example.com>', + '=?utf-8?Q?=C3=88xample=20User?= <èxample@example.com>', "Escape name but not email in email headers" ); @@ -32,7 +32,7 @@ is( is( $mail->addrlist_escape('example@example.com, éxample@example.com, Sömeone Ëlse ', true), - 'example@example.com, éxample@example.com,=?utf-8?Q?S=C3=B6meone_=C3=8Blse?= ', + 'example@example.com, éxample@example.com, =?utf-8?Q?S=C3=B6meone=20=C3=8Blse?= ', "Don't escape email addresses but escape realnames" ); @@ -42,6 +42,11 @@ is( "Don't remove quoting characters from realname" ); +is( + $mail->addrlist_escape('"Schmitt, Sören" ', true), + '=?utf-8?Q?"Schmitt,=20S=C3=B6ren"?= ', + "Don't remove quoting characters from realname when it contains a quotable character" +); $mail = new it_mail(array( 'From' => 'Someone Ïmportant <ïmportant@search.ch>', @@ -53,25 +58,25 @@ $mail = new it_mail(array( is( $mail->to[0], - 'éxample@example.com, example@example.com,=?utf-8?Q?S=C3=B6meone_=C3=8Blse?= , "Alfred E. Neuman" ,=?utf-8?Q?Schmitt,_S=C3=B6ren?= ', + 'éxample@example.com, example@example.com, =?utf-8?Q?S=C3=B6meone=20=C3=8Blse?= , "Alfred E. Neuman" , =?utf-8?Q?"Schmitt,=20S=C3=B6ren"?= ', 'Escape To: field as addrlist' ); is( $mail->cc[0], - 'éxample@example.com, example@example.com,=?utf-8?Q?S=C3=B6meone_=C3=8Blse?= , "Alfred E. Neuman" ,=?utf-8?Q?Schmitt,_S=C3=B6ren?= ', + 'éxample@example.com, example@example.com, =?utf-8?Q?S=C3=B6meone=20=C3=8Blse?= , "Alfred E. Neuman" , =?utf-8?Q?"Schmitt,=20S=C3=B6ren"?= ', 'Escape Cc: field as addrlist' ); is( $mail->bcc[0], - 'éxample@example.com, example@example.com,=?utf-8?Q?S=C3=B6meone_=C3=8Blse?= , "Alfred E. Neuman" ,=?utf-8?Q?Schmitt,_S=C3=B6ren?= ', + 'éxample@example.com, example@example.com, =?utf-8?Q?S=C3=B6meone=20=C3=8Blse?= , "Alfred E. Neuman" , =?utf-8?Q?"Schmitt,=20S=C3=B6ren"?= ', 'Escape Bcc: field as addrlist' ); is( $mail->header_values[0], - '=?utf-8?Q?Someone_=C3=8Fmportant?= <ïmportant@search.ch>', + '=?utf-8?Q?Someone=20=C3=8Fmportant?= <ïmportant@search.ch>', 'Escape From: field as addrlist' ); -- cgit v1.2.3