Package com.netlang.mail
Class Mailbox
java.lang.Object
com.netlang.mail.MailFolder
com.netlang.mail.Mailbox
This class handles the connection to a POP3 server. It is used for retrieving folders and mails.
Note that this is only for internal use please use the static method connectPOP3 instead.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close mailboxstatic MailboxconnectGMail(MailConnection con, String user, String password) Connect to a GMail server, this is actually a IMAPS connection with imap.googlemail.comstatic MailboxconnectIMAP(MailConnection con, String mailserver, String user, String password, boolean useSSL) Connects to a mailbox using IMAPstatic MailboxconnectIMAP(MailConnection con, String mailserver, String user, String password, boolean useSSL, Properties props) static MailboxconnectMs365(MailConnection con, String clientid, String clientSecret, String tenant, String mailUser) Connect to a GMail server, this is actually a IMAPS connection with imap.googlemail.comstatic MailboxconnectPOP3(MailConnection con, String mailserver, String user, String password, int port, boolean useSSL) Connect to a POP3 mailservergetInbox()Returns the inboxbooleanMethods inherited from class com.netlang.mail.MailFolder
createFolder, createFolderContainer, deleteAllMessages, deleteMessages, deleteMessages, deleteUnreadMessages, first, getDeletedMessageCount, getDeletedMessages, getFolder, getFolder, getFolder, getFolderNames, getFolders, getFolders, getFullName, getLastMessages, getMessage, getMessageCount, getMessages, getMessages, getName, getNewMessageCount, getUnreadMessageCount, getUnreadMessages, hasMore, moveAllMessages, moveMessage, moveMessages, moveMessages, moveUnreadMessages, next, openForUpdate, permanentlyRemoveDeleted, searchMessages, searchMessages, searchMessages, searchMessages, searchMessagesInternal
-
Method Details
-
connectPOP3
public static Mailbox connectPOP3(MailConnection con, String mailserver, String user, String password, int port, boolean useSSL) throws Exception Connect to a POP3 mailserver- Parameters:
mailserver- the addressuser- the usernamepassword- the passwordport- the portuseSSL- true if SSL should be used.- Returns:
- the new Mailbox connection
- Throws:
Exception
-
connectIMAP
public static Mailbox connectIMAP(MailConnection con, String mailserver, String user, String password, boolean useSSL) throws Exception Connects to a mailbox using IMAP- Parameters:
mailserver-user-password-- Returns:
- Throws:
Exception
-
connectIMAP
public static Mailbox connectIMAP(MailConnection con, String mailserver, String user, String password, boolean useSSL, Properties props) throws Exception - Throws:
Exception
-
connectGMail
public static Mailbox connectGMail(MailConnection con, String user, String password) throws Exception Connect to a GMail server, this is actually a IMAPS connection with imap.googlemail.com- Parameters:
user- the GMail accountpassword- the password- Returns:
- the mailbox
- Throws:
Exception
-
connectMs365
public static Mailbox connectMs365(MailConnection con, String clientid, String clientSecret, String tenant, String mailUser) throws Exception Connect to a GMail server, this is actually a IMAPS connection with imap.googlemail.com- Parameters:
user- the GMail accountpassword- the password- Returns:
- the mailbox
- Throws:
Exception
-
hasExpired
public boolean hasExpired() -
getInbox
Returns the inbox- Returns:
- the inbox as a MailFolder.
- Throws:
Exception
-
close
public void close()Close mailbox- Overrides:
closein classMailFolder
-