Using JBoss 3.2.7
I am aware that I can have configuration settings for my smtp server in mail-service.xml and attach it to a JNDI entry.
Is it possible to add these settings dynamically through code?
This is the scenario:
I run multiple sites (customer sites) on the same webapp. Each of these (should) use their custom defined smtp server, reply-to and from settings. The intention is to have them configure it through the webapp.
How do I do that without having it (pre)configured in mail-service.xml?
Can I pass-in the settings when establishing my mail session through the properties parametter?
Something like this
Properties props = System.getProperties(); props.put("mail.smtp.host", "my_smtp_server"); // More configs to go... Session mailSession = Session.getDefaultInstance(props, null); // Go ahead use the mailSession