Package io.jmix.imap
Interface ImapManager
- All Known Implementing Classes:
ImapManagerImpl
public interface ImapManager
Gateway for E-mail servers communication via IMAP protocol
Provides operations for
Connection details for mailbox are specified in
Folder is uniquely defined by its mailbox and full name (considering tree structure of folders), it is represented by
Message is uniquely defined by its folder and UID, it is represented by
Provides operations for
- IMAP mailbox (in terms of IMAP it is server) folders (in terms of IMAP it is mailbox) retrieval
- Messages retrieval
- Messages modification
Connection details for mailbox are specified in
ImapMailBox
object.
Folder is uniquely defined by its mailbox and full name (considering tree structure of folders), it is represented by
ImapFolder
object
Message is uniquely defined by its folder and UID, it is represented by
ImapMessage
object,
UID is specified in ImapMessage.getMsgUid()
property-
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteMessage
(ImapMessage message) Delete messagefetchFolders
(ImapMailBox mailBox) Retrieve all folders of mailbox preserving tree structurefetchFolders
(ImapMailBox mailBox, String... folderNames) Retrieve folders of mailbox with specified full names, result is presented in flat structure hiding parent\child relationshipfetchMessage
(ImapMessage message) Retrieve single messagevoid
moveMessage
(ImapMessage message, String folderName) Move message in different folder, if folder is the same - nothing changed, if folder with specified full name doesn't exist - results in throwingImapException
void
setFlag
(ImapMessage message, ImapFlag flag, boolean set) Change meta data flag for message, flag can be either standard or custom oneCheck a connection for specified mail box
-
Method Details
-
testConnection
Check a connection for specified mail box- Parameters:
box
- mail box to connect- Returns:
- result of set connection
-
fetchFolders
Retrieve all folders of mailbox preserving tree structure- Parameters:
mailBox
- IMAP mailbox connection details- Returns:
- root folders of IMAP mailbox, each folder can contain nested child folders forming tree structure
-
fetchFolders
Retrieve folders of mailbox with specified full names, result is presented in flat structure hiding parent\child relationship- Parameters:
mailBox
- IMAP mailbox connection detailsfolderNames
- full names of folders to retrieve- Returns:
- folders of IMAP mailbox with specified full names, result is ordered according to order of names input
-
fetchMessage
Retrieve single message- Parameters:
message
- reference object for IMAP message- Returns:
- fully fetched message or null if there is no message with such UID in corresponding folder
- Throws:
ImapException
- if wrong folder or mailbox connection details are specified in parameter
-
moveMessage
Move message in different folder, if folder is the same - nothing changed, if folder with specified full name doesn't exist - results in throwingImapException
- Parameters:
message
- reference object for IMAP messagefolderName
- full name of new folder- Throws:
ImapException
- for wrong folder
-
deleteMessage
Delete message- Parameters:
message
- reference object for IMAP message
-
setFlag
Change meta data flag for message, flag can be either standard or custom one- Parameters:
message
- reference object for IMAP messageflag
- flag to changeset
- if true - set the flag, if false - clear the flag
-