On 26/11/2024 08:42, Ricardo Almeida wrote:
Hi,

I'm trying to configure Jakarta Mail using JNDI but it seems there's
some issue setting up the parameters Tomcat should pass on to Jakarta
Mail.

I configured it using:

     <Resource
         global="mail/Session"
         name="mail/Session"
         auth="Container"
         type="jakarta.mail.Session"
     />
     <ResourceParams name="mail/Session">

Support for ResourceParams was removed just over 20 years ago in this svn commit:

https://svn.apache.org/viewvc?view=revision&revision=303032

I see there are a few stray references to it still present in the Tomcat docs - mainly the Java doc - and I'll get those removed shortly.

You should be able to add these directly to the <Resource .../> element as attributes and values.

Mark

         <parameter>
             <name>mail.smtp.starttls.enable</name><value>true</value>
         </parameter>
         <parameter>
             
<name>mail.smtp.host</name><value>smtp.email.eu-frankfurt-1.oci.oraclecloud.com</value>
         </parameter>
         <parameter>
           <name>mail.smtp.port</name><value>587</value>
         </parameter>
         <parameter>
           <name>mail.from</name><value>f...@email.com</value>
         </parameter>
         <parameter>
           <name>mail.smtp.auth</name><value>true</value>
         </parameter>
         <parameter>
           <name>mail.smtp.user</name><value>ocid1.user.oc1...com</value>
         </parameter>
         <parameter>
           <name>password</name><value>password</value>
         </parameter>
     </ResourceParams>

But, I got Exception trying to connect to localhost port 25, instead
of the parameters set!

Caused by: org.eclipse.angus.mail.util.MailConnectException: Couldn't
connect to host, port: localhost, 25; timeout -1
     at 
org.eclipse.angus.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2243)
~[angus-mail-2.0.3.jar:?]
     at 
org.eclipse.angus.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:729)
~[angus-mail-2.0.3.jar:?]
     at jakarta.mail.Service.connect(Service.java:345)
~[jakarta.mail-api-2.1.3.jar:?]

Any idea what I'm doing wrong?

Regards,
Ricardo Almeida

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to