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!

Javamail adding some default properties for IMAP protocol

843834Jul 16 2010 — edited Jul 16 2010
Hi,

I'm using Javamail API 1.4.2 to read emails using IMAPS and POP3S. It looks like Javamail API adding some properties by default.Though I'm using the IMAPS to get mail store it's adding some plain imap related properties like mail.imap.fetchsize, mail.imap.statuscachetimeout, mail.imap.appendbuffersize and mail.imap.minidletime+.
see the debug trace below:

DEBUG: setDebug: JavaMail version 1.4.2
DEBUG: getProvider() returning javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc]
DEBUG: mail.imap.fetchsize: 16384
DEBUG: mail.imap.statuscachetimeout: 1000
DEBUG: mail.imap.appendbuffersize: -1
DEBUG: mail.imap.minidletime: 10
DEBUG: trying to connect to host "myhost", port 993, isSSL true
* OK The Microsoft Exchange IMAP4 service is ready.
A0 CAPABILITY
* CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=GSSAPI IDLE NAMESPACE LITERAL+
A0 OK CAPABILITY completed.
IMAP DEBUG: AUTH: NTLM
IMAP DEBUG: AUTH: GSSAPI
DEBUG: protocolConnect login, host=myhost, user=myuser, password=<non-null>
A1 LOGIN myuser password
A1 OK LOGIN completed.
A2 CAPABILITY
* CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=GSSAPI IDLE NAMESPACE LITERAL+
A2 OK CAPABILITY completed.
IMAP DEBUG: AUTH: NTLM
IMAP DEBUG: AUTH: GSSAPI
DEBUG: connection available -- size: 1
A3 SELECT INBOX
* 0 EXISTS
* 0 RECENT
* FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
* OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Permanent flags
* OK [UIDVALIDITY 184] UIDVALIDITY value
* OK [UIDNEXT 13] The next unique identifier value
A3 OK [READ-WRITE] SELECT completed.

I have tried Jamail API 1.4.3 but the result is same. I think the protocols for IMAPS should be *mail.imaps.fetchsize, mail.imaps.statuscachetimeout,
mail.imaps.appendbuffersize* and mail.imaps.minidletime+.

Here is the code I have used to get the store
public static Store getMailStore(String protocol, String emailServerHostName,
int portNumber, String userName, String password) throws MessagingException {
Store store;
Properties props = new Properties();
boolean isSessionDebugEnabled = false;

props.put("mail.host", emailServerHostName);
props.put("mail.port", portNumber);
props.put("mail.user", userName);


props.put("mail.store.protocol", protocol);

Session session = Session.getDefaultInstance(props, null);
session.setDebug(true);
store.connect(emailServerHostName, portNumber, userName, password);
return store;
}



public static void main(String[] args) {
Store store = null;
try {
store = getMailStore("imaps", "myhost", 993, "myuser", "password");
Folder inboxFolder = openFolderForRW(store, "INBOX");
} catch (MessagingException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}

Am I need to add these properties manually for IMAPS?

Thanks,
PrasadKT
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 13 2010
Added on Jul 16 2010
1 comment
387 views