diff options
Diffstat (limited to 'tests/it_mail.t')
-rwxr-xr-x | tests/it_mail.t | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/tests/it_mail.t b/tests/it_mail.t index 1762788..486dee8 100755 --- a/tests/it_mail.t +++ b/tests/it_mail.t @@ -9,19 +9,25 @@ $mail = new it_mail(); is( $mail->addrlist_escape('éxample@example.com', true), 'éxample@example.com', - "Don't escape plain email addresses in email headers", + "Don't escape plain email addresses in email headers" ); is( $mail->header_escape('éxample@example.com'), '=?utf-8?Q?=C3=A9xample@example.com?=', - "Escape plain email in non-email headers", + "Escape plain email in non-email headers" +); + +is( + $mail->header_escape('search.ch e-mail code d\'accès'), + '=?utf-8?B?c2VhcmNoLmNoIGUtbWFpbCBjb2RlIGQnYWNjw6hz?=', + "Use base64 encoding when php iconv fails with quoted-printable (workaround for php bug #53891)" ); is( $mail->addrlist_escape('Èxample User <èxample@example.com>', true), - '=?utf-8?Q?=C3=88xample_User?= <èxample@example.com>', - "Escape name but not email in email headers", + '=?utf-8?Q?=C3=88xample=20User?= <èxample@example.com>', + "Escape name but not email in email headers" ); is( @@ -32,51 +38,56 @@ is( is( $mail->addrlist_escape('example@example.com, éxample@example.com, Sömeone Ëlse <sömeone@example.com>', true), - 'example@example.com, éxample@example.com,=?utf-8?Q?_S=C3=B6meone_=C3=8Blse?= <sömeone@example.com>', - "Don't escape email addresses but escape realnames", + 'example@example.com, éxample@example.com, =?utf-8?Q?S=C3=B6meone=20=C3=8Blse?= <sömeone@example.com>', + "Don't escape email addresses but escape realnames" ); is( $mail->addrlist_escape('"Alfred E. Neuman" <neuman@example.com>', true), '"Alfred E. Neuman" <neuman@example.com>', - "Don't remove quoting characters from realname", + "Don't remove quoting characters from realname" ); +is( + $mail->addrlist_escape('"Schmitt, Sören" <schmitt@example.com>', true), + '=?utf-8?Q?"Schmitt,=20S=C3=B6ren"?= <schmitt@example.com>', + "Don't remove quoting characters from realname when it contains a quotable character" +); -$mail = new it_mail( +$mail = new it_mail(array( 'From' => 'Someone Ïmportant <ïmportant@search.ch>', - 'To' => 'éxample@example.com, example@example.com, Sömeone Ëlse <sömeone@example.com>, "Alfred E. Neuman" <neuman@example.com>', - 'Cc' => 'éxample@example.com, example@example.com, Sömeone Ëlse <sömeone@example.com>, "Alfred E. Neuman" <neuman@example.com>', - 'Bcc' => 'éxample@example.com, example@example.com, Sömeone Ëlse <sömeone@example.com>, "Alfred E. Neuman" <neuman@example.com>', - 'Subject' => "§önÐë®z€ı¢ħèṇ", -); + 'To' => 'éxample@example.com, example@example.com, Sömeone Ëlse <sömeone@example.com>, "Alfred E. Neuman" <neuman@example.com>, "Schmitt, Sören" <schmitt@example.com>', + 'Cc' => 'éxample@example.com, example@example.com, Sömeone Ëlse <sömeone@example.com>, "Alfred E. Neuman" <neuman@example.com>, "Schmitt, Sören" <schmitt@example.com>', + 'Bcc' => 'éxample@example.com, example@example.com, Sömeone Ëlse <sömeone@example.com>, "Alfred E. Neuman" <neuman@example.com>, "Schmitt, Sören" <schmitt@example.com>', + 'Subject' => "§önÐë®z€ı¢ħèṇ" +)); is( $mail->to[0], - 'éxample@example.com, example@example.com,=?utf-8?Q?_S=C3=B6meone_=C3=8Blse?= <sömeone@example.com>, "Alfred E. Neuman" <neuman@example.com>', - 'Escape To: field as addrlist', + 'éxample@example.com, example@example.com, =?utf-8?Q?S=C3=B6meone=20=C3=8Blse?= <sömeone@example.com>, "Alfred E. Neuman" <neuman@example.com>, =?utf-8?Q?"Schmitt,=20S=C3=B6ren"?= <schmitt@example.com>', + 'Escape To: field as addrlist' ); is( $mail->cc[0], - 'éxample@example.com, example@example.com,=?utf-8?Q?_S=C3=B6meone_=C3=8Blse?= <sömeone@example.com>, "Alfred E. Neuman" <neuman@example.com>', - 'Escape Cc: field as addrlist', + 'éxample@example.com, example@example.com, =?utf-8?Q?S=C3=B6meone=20=C3=8Blse?= <sömeone@example.com>, "Alfred E. Neuman" <neuman@example.com>, =?utf-8?Q?"Schmitt,=20S=C3=B6ren"?= <schmitt@example.com>', + 'Escape Cc: field as addrlist' ); is( $mail->bcc[0], - 'éxample@example.com, example@example.com,=?utf-8?Q?_S=C3=B6meone_=C3=8Blse?= <sömeone@example.com>, "Alfred E. Neuman" <neuman@example.com>', - 'Escape Bcc: field as addrlist', + 'éxample@example.com, example@example.com, =?utf-8?Q?S=C3=B6meone=20=C3=8Blse?= <sömeone@example.com>, "Alfred E. Neuman" <neuman@example.com>, =?utf-8?Q?"Schmitt,=20S=C3=B6ren"?= <schmitt@example.com>', + 'Escape Bcc: field as addrlist' ); is( $mail->header_values[0], - '=?utf-8?Q?Someone_=C3=8Fmportant?= <ïmportant@search.ch>', - 'Escape From: field as addrlist', + '=?utf-8?Q?Someone=20=C3=8Fmportant?= <ïmportant@search.ch>', + 'Escape From: field as addrlist' ); is( $mail->subject, "§önÐë®z€ı¢ħèṇ", - "Don't escape Subject: field on instanziation", + "Don't escape Subject: field on instanziation" ); |