[ 
https://issues.apache.org/jira/browse/MIME4J-239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14031650#comment-14031650
 ] 

Stefano Bagnara edited comment on MIME4J-239 at 6/14/14 6:59 PM:
-----------------------------------------------------------------

This doesn't sounds as a bug. The "mailbox" you're trying to parse is invalid.

the syntax si [phrase] [routeaddress]
the "<...>" part is the routeaddress.
The phrase syntax is defined as: 
- A phrase is a word or a sequence of words.
- An word is either an atom or a quoted string.
- An atom is a sequence of printable ASCII characters except space or any of 
the following: ()<>@,;:\".[]

So , the "@" can't be contained in an atom, so it must be quoted.

So, these 2 should pass:
joe"@"my company <[email protected]>
"joe@my company" <[email protected]>
but
joe@my company <[email protected]>
without quotes is not valid.



rfc2822 - 3.2.4. Atom  - defines atom as follow:
-----
atext           =       ALPHA / DIGIT / ; Any character except controls,
                        "!" / "#" /     ;  SP, and specials.
                        "$" / "%" /     ;  Used for atoms
                        "&" / "'" /
                        "*" / "+" /
                        "-" / "/" /
                        "=" / "?" /
                        "^" / "_" /
                        "`" / "{" /
                        "|" / "}" /
                        "~"

atom            =       [CFWS] 1*atext [CFWS]
-----


was (Author: bago):
This doesn't sounds as a bug. The "mailbox" you're trying to parse is invalid.

the syntax si [phrase] [routeaddress]
the "<...>" part is the routeaddress.
The phrase syntax is defined as: 
- A phrase is a word or a sequence of words.
- An word is either an atom or a quoted string.
- An atom is a sequence of printable ASCII characters except space or any of 
the following: ()<>@,;:\".[]

So , the "@" can't be contained in an atom, so it must be quoted.

So, these 2 should pass:
joe"@"my company <[email protected]>
"joe@my company" <[email protected]>
but
joe@my company <[email protected]>
without quotes is not valid.


> AddressBuilder#parseMailbox fails when the local part contains a '@'
> --------------------------------------------------------------------
>
>                 Key: MIME4J-239
>                 URL: https://issues.apache.org/jira/browse/MIME4J-239
>             Project: James Mime4j
>          Issue Type: Bug
>    Affects Versions: 0.7.2
>            Reporter: Nitsan Seniak
>            Priority: Critical
>
> The following calls throws an exception:
> Mailbox add = AddressBuilder.DEFAULT.parseMailbox("joe@my company 
> <[email protected]>");
> The exception is:
> org.apache.james.mime4j.field.address.ParseException: Atoms in domain names 
> must be separated by '.'
> The expected result is (Hamcrest syntax):
> Mailbox add = AddressBuilder.DEFAULT.parseMailbox("joe@my company 
> <[email protected]>");
> assertThat(add.getAddress(), is("[email protected]"));
> assertThat(add.getLocalPart(), is("joe@my company"));



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to