No you can extend MailConfiguration in your own class and invoke the getInstance method. And then configure your mail configuration on the mail component. Then Camel will use your class instead of its own.
The current code calls:
Session session = Session.getDefaultInstance(prop, getAuthenticator());
But what you want to do is:
Session session = Session.getInstance(prop, getAuthenticator());
I wonder what the difference is between these two methods. Well gotta check the javadoc API for Java Mail
Thanks for the reply.I will try with this.
Just wanted to share , what I saw in the doc.
It looks like the default session , which may contain credentials is denied if objects are called from two different classloader.
But if the Authenticator object used to create the session is null, we can get the default session.
Let me know how it goes with your extension.
We could probably add that as a fallback into camel-mail. However a unit test to demonstrate the issue is probably not easy to create.