cancel
Showing results for 
Search instead for 
Did you mean: 

Javamail Client Service

sid-desh
Advisor
Advisor
0 Kudos

Hi,

I have maintained some values in the Javamail Client Service in the Visual Administrator. The values are maintained for mail.from and smtp properties.

However i am unable to read to these values from the my webdynpro application. javax.mail.Session.getProvider(String) is not returning any value.

Please provide any suggestions as to how i can read these values. I have trying this for quite some time now without any result.

Thanks and Regards

Sidharth

Accepted Solutions (1)

Accepted Solutions (1)

former_member185706
Participant
0 Kudos

Hi,

you have to use javax.mail.Session object , bound to naming.

Here is usage example :

<b>Properties props = new Properties();

props.put( "domain", "true" );

Context initialContext = new InitialContext( props );

Session ses = ( Session )initialContext.lookup( "java:comp/env/mail/MailSession" );</b>

Regards

Bojidar

sid-desh
Advisor
Advisor
0 Kudos

Hi Bojidar,

Thanks a lot for the reply. I had been waiting for this solution for quite some time now.

Just one thing i would like to know. How do you get this string value java:comp/env/mail/MailSession and when do we have to decide when we have to use the objects bound to naming. Please do provide some insight into this.

Regards

Sidharth

former_member185706
Participant
0 Kudos

Hi Sidharth,

this is the standard prefix for binding instantiated javax.mail.Session object, initialized with service properties. If the application needs to use the properties , it should lookup this object.

Anyway you can use Session.getDefaultInstance(Properties) or JavaMail API to set properties runtime.

Regards

Bojidar

Answers (0)