Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. public void connect() {
  2. try {
  3. if (imapStore == null) {
  4. Session emailSession = Session.getInstance(properties, null);
  5. // emailSession.setDebug(true);
  6. imapStore = (IMAPStore) emailSession.getStore(mailProtocol);
  7. imapStore.connect(host, username, password);
  8. }
  9. } catch (Exception e) {
  10. log.error("unable to connect", e);
  11. }
  12. }
  13.  
  14. public boolean isConnected() {
  15. return imapStore != null && imapStore.isConnected() ? true : false;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement