>> - For whatever reason there are mail servers that demand the whole
>> email address as the login ID.  java.net.URI is incapable of handling
>> things like
>>
>> imap://b...@dummy.com@dummy.com?password=test
>> imap://dummy.com?password=test&username=b...@dummy.com
>>
>> You can probably direct-parse the URI using getAuthority() to get the
>> part before the question mark and getQuery() for the rest, looking for
>> embedded @.  I did a workaround in my application instead:
>>
>> final Endpoint inmail = camelcontext.getEndpoint("imap://" + server +
>> "?delete=true");
>> MailEndpoint minmail = (MailEndpoint) inmail;
>> MailConfiguration mconfig = minmail.getConfiguration();
>> mconfig.setUsername(username);
>> mconfig.setPassword(password);
>>
>
> Care to explain a bit more? Ah the username has @ in it? Is that the problem?

Yes, MailConfiguration uses java.net.URI to parse the endpoint string.
 When you have

imap://n...@mailserver.com@mailserver.com

both getHost() and getUserInfo() come back null.  When you have

imap://mailserver.com?username=n...@mailserver.com

getHost() works, but getUserInfo() still comes back null.

Either way it doesn't connect to the server.  Using
MailConfiguration's setUsername() works even with the @ in the user
name.

Reply via email to