Best Practices

Reading messages from an IMAP server is similar to reading messages from a POP3 server. With IMAP, however, the JavaMail API provides methods to create and manipulate folders and transfer messages between them. If you use an IMAP server, you can implement a full-featured, Web-based mail client with much less code than if you use a POP3 server. With POP3, you must provide code to manage a message store through your application server, possibly using a database or file system to represent folders.

One of J2EE's objectives is portability, and it always recommends a declarative approach over a programmatic approach to avoid hardcoding parameters. Avoid the programmatic approach as much as possible. Create and configure the Session object in a JNDI service as an administered object, so that you can tune it or change its parameters without changing any code.

It's always more efficient to use a shared Session object among all your components, even if you're working with mail sessions for multiple user mailboxes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.46.78