public interface InboundEmailService
| Modifier and Type | Method and Description |
|---|---|
EmailMessage |
copyMessage(EmailMessage message,
String targetFolder)
Makes a copy of given email message in the specified folder.
|
boolean |
createFolder(String folderName)
Creates a new folder with given name in the mailbox.
|
boolean |
deleteFolder(String folderName)
Deletes given mailbox folder with all messages and sub-folders contained in it.
|
void |
deleteMessage(EmailMessage message)
Deletes given email message from the mailbox.
|
void |
deleteMessages(List<EmailMessage> messages)
Deletes given email messages from the mailbox.
|
List<EmailMessage> |
fetchAllMessages(Predicate<EmailMessage> isSatisfy)
Gets all email messages contained in all mailbox folders and satisfy to specific condition.
|
EmailMessage |
fetchMessage(String messageId)
Searches email message in the mailbox with given message ID.
|
List<EmailMessage> |
fetchMessages(String folderName,
Predicate<EmailMessage> isSatisfy)
Gets email messages contained in the mailbox folder with given name and satisfy to specific condition.
|
List<EmailMessage> |
fetchUnreadMessages(String folderName,
boolean markRead)
Gets unread messages contained in the mailbox folder with given name.
|
int |
getMessageCount(String folderName)
Gets amount of email messages in the mailbox folder with given name.
|
List<String> |
listFolders()
Gets the list of folder names that are present in the mailbox.
|
EmailMessage |
moveMessage(EmailMessage message,
String targetFolder)
Moves given email message to the specified folder.
|
boolean |
renameFolder(String folderName,
String newFolderName)
Renames given mailbox folder.
|
void |
updateMessage(EmailMessage message)
Updates parameters of given email message in the mailbox.
|
void |
updateMessages(List<EmailMessage> messages)
Updates parameters of given email messages in the mailbox.
|
CompletableFuture<List<EmailMessage>> |
waitMessages(String folderName,
Predicate<EmailMessage> isSatisfy,
Duration timeout,
Duration checkInterval)
Waits appearing of email messages in the mailbox folder with given name that satisfy to specific condition.
|
int getMessageCount(String folderName)
folderName - the name of mailbox folder where is necessary to count messages.EmailMessage fetchMessage(String messageId)
It views all mailbox folders to find the necessary message.
messageId - the unique identifier of email message that is necessary to find.EmailMessage object representing found email message or null if nothing is found.List<EmailMessage> fetchMessages(String folderName, Predicate<EmailMessage> isSatisfy)
folderName - the name of mailbox folder where is necessary to collect email messages.isSatisfy - lambda expression representing specific condition. It should return true to let
email message get into results.EmailMessage objects representing satisfying email messages.List<EmailMessage> fetchAllMessages(Predicate<EmailMessage> isSatisfy)
isSatisfy - lambda expression representing specific condition. It should return true to let
email message get into results.EmailMessage objects representing satisfying email messages.List<EmailMessage> fetchUnreadMessages(String folderName, boolean markRead)
folderName - the name of mailbox folder where is necessary to search unread messages.markRead - whether is necessary to mark all found unread messages as read immediately.EmailMessage objects representing unread email messages.CompletableFuture<List<EmailMessage>> waitMessages(String folderName, Predicate<EmailMessage> isSatisfy, Duration timeout, Duration checkInterval)
folderName - the name of mailbox folder where is necessary to check messages.isSatisfy - lambda expression representing specific condition. It should return true to let
email message get into results.timeout - the maximum time of waiting necessary messages.checkInterval - amount of time that defines period of checking newly come messages.CompletableFuture object with list of EmailMessage objects representing satisfying email
messages as result.EmailMessage copyMessage(EmailMessage message, String targetFolder)
message - the source email message that should be copied.targetFolder - the name of mailbox folder where the email message should be copied.EmailMessage object representing copied message.EmailMessage moveMessage(EmailMessage message, String targetFolder)
message - the source email message that should be moved.targetFolder - the name of mailbox folder where the email message should be moved.EmailMessage object representing moved message. The source message will be deleted.void updateMessage(EmailMessage message)
message - the email message whose parameters should be updated in the mailbox.void updateMessages(List<EmailMessage> messages)
messages - the list of email messages whose parameters should be updated in the mailbox.void deleteMessage(EmailMessage message)
The message is deleted permanently without Trash.
message - the email message to delete.void deleteMessages(List<EmailMessage> messages)
Messages are deleted permanently without Trash.
messages - the list of email messages to delete.List<String> listFolders()
boolean createFolder(String folderName)
folderName - the name of folder to create.true if the folder has been created successfully and false otherwise.boolean renameFolder(String folderName, String newFolderName)
folderName - the name of source mailbox folder.newFolderName - a new name of the folder.true if the folder has been renamed successfully and false otherwise.boolean deleteFolder(String folderName)
folderName - the name of mailbox folder to delete.true if the folder has been deleted successfully and false otherwise.Copyright © 2023. All rights reserved.