Yes, see above, and you can do even better: you can put the entire mail session in context.xml:
<Resource name="mail/xyz" type="javax.mail.Session" auth="Container" mail.pop3.connectiontimeout="60000" mail.pop3.host="pop.hhhh.net" mail.pop3.port="110" mail.pop3.timeout="60000" mail.smtp.auth="true" mail.smtp.connectiontimeout="60000" mail.smtp.host="smtpout.hhhh.net" mail.smtp.port="3535" mail.smtp.sendpartial="true" mail.smtp.timeout="60000" mail.store.maildir.autocreatedir="true" mail.store.protocol="pop3" mail.transport.protocol="smtp" mail.from=" abc@xyz.com " mail.user="xyz" mail.host="xyz.com" mail.debug="false" password="xyz" />
Then just look at java:comp/env/mail/xyz
and this is javax.mail.Session.
Please note that if you provide the password
attribute, Tomcat will also install Authenticator for you.
source share