Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

using imaps protocol in the database to connect to mail server

Richard LeggeOct 13 2021 — edited Oct 13 2021

Hi All,
Using SE 12.1,0.1.0
Im using a java stored procedure trying to connect to a mail server running imap over TLS on port 993. therefore In the code, I'm trying to set the protocol to imaps
Extract from zimbra guide:
image.pngThe code is:

  Properties props = new Properties();
  props.setProperty("mail.imap.starttls.Enable", "true");
  props.setProperty("mail.imaps.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
  props.setProperty("mail.imaps.socketFactory.fallback", "false");
  props.setProperty("mail.imaps.port", "993");
  props.setProperty("mail.imaps.socketFactory.port", "993");
  props.setProperty("mail.store.protocol", sProtocol);
  props.setProperty("mail.mime.address.strict", "false"); 
  oMailSession = Session.getInstance(props);
  oMailStore  = oMailSession.getStore();
  oMailStore.connect(sHost, 993, sUser, sPass);
  bIsConnected = true;

where sProtocol is imaps
However when I run it, I get

ORA-29532: Java call terminated by uncaught Java exception: javax.mail.NoSuchProviderException: No provider for imaps

My question is whether I can use imaps. researching, it seems you can set it in java. But I don't know whether it supported in the database. The code works OK if I connect to a pop3 server on port 110 (no SSL/TLS obviously). Also, I don't know whether whether setting the starttls is required at all?
If I try using just imap as the protocol rather than imaps (and keep starttls enabled) on port 993 get the following exception

ORA-29532: Java call terminated by uncaught Java exception: javax.mail.MessagingException: null;
 nested exception is: 
	java.io.IOException

I can log into the mail server using outlook using the same credentials (i.e imap, TLS/SS, 993 with the same username and password.)
Any help would be appreciated (my java is very very rusty btw)
Regards
Richard

Comments

Processing

Post Details

Added on Oct 13 2021
0 comments
561 views