Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4831 from cyrusimap/parseaddr_utf8_domain
Parse email addresses with non-ASCII UTF8 domain parts
- Loading branch information
Showing
6 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
From: J. Besteiro <jb@julián.example.com> | ||
To: to@local | ||
Subject: test | ||
Date: Mon, 13 Apr 2020 15:34:03 +0200 | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain;charset=us-ascii | ||
Content-Transfer-Encoding: 7bit | ||
|
||
hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!perl | ||
use Cassandane::Tiny; | ||
|
||
sub test_email_get_utf8_domain | ||
:min_version_3_9 :needs_component_jmap :NoMunge8Bit :RFC2047_UTF8 | ||
{ | ||
my ($self) = @_; | ||
my $jmap = $self->{jmap}; | ||
my $imap = $self->{store}->get_client(); | ||
|
||
open(my $F, "data/mime/utf8-domain.bin") || die $!; | ||
$imap->append('INBOX', $F) || die $@; | ||
close($F); | ||
|
||
my $res = $jmap->CallMethods([ | ||
['Email/query', { }, 'R1'], | ||
['Email/get', { | ||
'#ids' => { | ||
resultOf => 'R1', | ||
name => 'Email/query', | ||
path => '/ids' | ||
}, | ||
properties => ['from', 'subject'], | ||
}, 'R2'], | ||
]); | ||
|
||
use utf8; | ||
$self->assert_deep_equals([{ | ||
name => 'J. Besteiro', | ||
email => 'jb@julián.example.com', | ||
}], $res->[1][1]{list}[0]{from}); | ||
no utf8; | ||
|
||
$imap->select('INBOX'); | ||
$res = $imap->fetch('1:*', 'ENVELOPE'); | ||
$self->assert_str_equals('"J. Besteiro" <jb@julián.example.com>', | ||
$res->{1}{envelope}{From}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Description: | ||
Updates the email address parser to preserve non-ASCII characters | ||
in the domain part. | ||
|
||
|
||
Config changes: | ||
None. | ||
|
||
|
||
Upgrade instructions: | ||
Reconstruct mailboxes with the -G option to force reparsing email headers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters