| Modifier and Type | Field and Description |
|---|---|
protected static String |
AMY_MAIL_ADDRESS_KEY
Key for the Amy mail address in the config - declared protected for tests
|
protected static String |
AMY_MAIL_PW_KEY
Key for the Amy mail password in the config - declared protected for tests
|
| Constructor and Description |
|---|
EMailLogic() |
| Modifier and Type | Method and Description |
|---|---|
void |
connectToMailServer()
Connect to mail server with stored credentials, if there are any
|
boolean |
connectToMailServer(EMailCredentials credentials)
Set up connection to mail server with given parameters.
|
void |
disconnectFromMailServer()
Disconnect from currently connected mail service
|
EMailCredentials |
getCredentials()
Get the currently saved mail credentials
|
MessageDTO[] |
getMailsForREST(int amount)
Get all mails in the inbox and convert them to MessageDTO objects for the REST class to send to the web app
|
int |
getNewMessageCount(boolean checkForImportant)
Returns number of new messages in inbox.
|
boolean |
hasNewMessages(boolean checkForImportant)
returns if unread messages have been found
|
boolean |
isConnectedToMailServer()
Check if mail is currently connected to a mail server
|
String |
printMessages(int amount,
boolean important)
Converts all new messages to a readable string
|
protected static final String AMY_MAIL_ADDRESS_KEY
protected static final String AMY_MAIL_PW_KEY
public boolean hasNewMessages(boolean checkForImportant)
checkForImportant - set this to true if you want to look for IMPORTANT new mails, set this to false if you only want to
look for new mailsIllegalStateException - when mail session is not connectedpublic int getNewMessageCount(boolean checkForImportant)
checkForImportant - put true here if you want the amount of new important mailsIllegalStateException - when mail session is not connectedpublic String printMessages(int amount, boolean important)
amount - amount of mails to print, put -1 here if you want every mail to be printedimportant - set this to true, if you only want the important mails to be converted, set this to false if you want
every message to be convertedIllegalStateException - when mail session is not connectedpublic MessageDTO[] getMailsForREST(int amount)
amount - the amount of mails, put -1 here if you want all mailsIllegalStateException - when mail session is not connectedpublic boolean connectToMailServer(EMailCredentials credentials)
credentials - the email credentialspublic boolean isConnectedToMailServer()
public void disconnectFromMailServer()
public EMailCredentials getCredentials()
@PostConstruct public void connectToMailServer()
Copyright © 2018. All rights reserved.