You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by tide08 <sa...@yahoo.com> on 2009/10/14 02:06:13 UTC
Camel Mail Component: "|" in email causes message to fail
It looks like there is minor bug in regex used in MailBinding.java, it causes
"|" to act as delimiter, splitting email address into 2 parts.
For ex: Using email address as - first|last@test.com causes it to split into
two parts:
1) first
2) last@test.com
"|" is acceptable character in email as per wikipedia
[http://en.wikipedia.org/wiki/Email_address]. I did not bother to read RFC
specification.
Here is snippet of code causing issue:
private static void appendRecipientToMimeMessage(MimeMessage mimeMessage,
String type, String recipient)
throws MessagingException {
// we support that multi recipient can be given as a string
seperated by comma or semi colon
String[] lines = recipient.split("[,|;]");
for (String line : lines) {
Regex above should either be "[,;]" or ";|,"
Also, having email addresses separate out by , or ; seems to be issue as it
can be part of name. ex: "firstName, I like comma <fi...@test.com>" is
valid. Above code will still cause failure for such messages. Can camel
support addresses as List/Array rather than comma delimited string?
--
View this message in context: http://www.nabble.com/Camel-Mail-Component%3A-%22%7C%22-in-email-causes-message-to-fail-tp25883099p25883099.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Mail Component: "|" in email causes message to fail
Posted by tide08 <sa...@yahoo.com>.
Thanks Claus!
Raised JIRA - https://issues.apache.org/activemq/browse/CAMEL-2067
tide08 wrote:
>
> It looks like there is minor bug in regex used in MailBinding.java, it
> causes "|" to act as delimiter, splitting email address into 2 parts.
>
> For ex: Using email address as - first|last@test.com causes it to split
> into two parts:
> 1) first
> 2) last@test.com
>
> "|" is acceptable character in email as per wikipedia
> [http://en.wikipedia.org/wiki/Email_address]. I did not bother to read RFC
> specification.
>
> Here is snippet of code causing issue:
>
> private static void appendRecipientToMimeMessage(MimeMessage mimeMessage,
> String type, String recipient)
> throws MessagingException {
>
> // we support that multi recipient can be given as a string
> seperated by comma or semi colon
> String[] lines = recipient.split("[,|;]");
> for (String line : lines) {
>
>
> Regex above should either be "[,;]" or ";|,"
>
> Also, having email addresses separate out by , or ; seems to be issue as
> it can be part of name. ex: "firstName, I like comma
> <fi...@test.com>" is valid. Above code will still cause failure for
> such messages. Can camel support addresses as List/Array rather than comma
> delimited string?
>
--
View this message in context: http://www.nabble.com/Camel-Mail-Component%3A-%22%7C%22-in-email-causes-message-to-fail-tp25883099p25895278.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Mail Component: "|" in email causes message to fail
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Could you create a JIRA ticket for this bug?
On Wed, Oct 14, 2009 at 2:06 AM, tide08 <sa...@yahoo.com> wrote:
>
> It looks like there is minor bug in regex used in MailBinding.java, it causes
> "|" to act as delimiter, splitting email address into 2 parts.
>
> For ex: Using email address as - first|last@test.com causes it to split into
> two parts:
> 1) first
> 2) last@test.com
>
> "|" is acceptable character in email as per wikipedia
> [http://en.wikipedia.org/wiki/Email_address]. I did not bother to read RFC
> specification.
>
> Here is snippet of code causing issue:
>
> private static void appendRecipientToMimeMessage(MimeMessage mimeMessage,
> String type, String recipient)
> throws MessagingException {
>
> // we support that multi recipient can be given as a string
> seperated by comma or semi colon
> String[] lines = recipient.split("[,|;]");
> for (String line : lines) {
>
>
> Regex above should either be "[,;]" or ";|,"
>
> Also, having email addresses separate out by , or ; seems to be issue as it
> can be part of name. ex: "firstName, I like comma <fi...@test.com>" is
> valid. Above code will still cause failure for such messages. Can camel
> support addresses as List/Array rather than comma delimited string?
> --
> View this message in context: http://www.nabble.com/Camel-Mail-Component%3A-%22%7C%22-in-email-causes-message-to-fail-tp25883099p25883099.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus