Class MailboxReaderFactoryImpl
java.lang.Object
ch.tocco.nice2.messaging.mail.impl.MailboxReaderFactoryImpl
- All Implemented Interfaces:
MailboxReaderFactory
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.tocco.nice2.messaging.mail.api.MailboxReaderFactory
MailboxReaderFactory.Mode
-
Constructor Summary
ConstructorDescriptionMailboxReaderFactoryImpl
(org.slf4j.Logger log, SessionFactory sessionFactory) -
Method Summary
Modifier and TypeMethodDescriptioncreateDirectoryReader
(Path directory, @Nullable String pattern) Create a mailbox reader that reads in emails in a local directory.Creates a reader for messages in a folder which is specified by theurl
argument.Creates a mail reader, that goes through all messages of the folder specified by theurl
argument and all its subfolders.void
setAdvancedAuth
(boolean advancedAuth) void
setAuthenticationScope
(String authenticationScope) void
setClientId
(String clientId) void
setClientSecret
(String clientSecret) void
setTokenEndpoint
(String tokenEndpoint)
-
Constructor Details
-
MailboxReaderFactoryImpl
-
-
Method Details
-
setAdvancedAuth
@Value("${email.auth.advancedAuth}") public void setAdvancedAuth(boolean advancedAuth) -
setTokenEndpoint
-
setClientId
-
setClientSecret
-
setAuthenticationScope
@Value("${email.auth.oauth.authenticationScope}") public void setAuthenticationScope(String authenticationScope) -
createMailFolderReader
public MailboxReader createMailFolderReader(String url, MailboxReaderFactory.Mode mode) throws MailException Description copied from interface:MailboxReaderFactory
Creates a reader for messages in a folder which is specified by theurl
argument. Theurl
must contain all information to connect to the mailbox. By default the protocols pop3 and imap are supported. For example, aurl
might look like this:imap://your.name%40gmail.com:password@imap.gmail.com:143/INBOX
Note, that the url must be x-www-form-urlencoded.- Specified by:
createMailFolderReader
in interfaceMailboxReaderFactory
- Parameters:
url
- the url to one folder inside a mail boxmode
- the mode used to open the folder- Returns:
- a reader for messages in the specified folder
- Throws:
MailException
-
createNestedMailFolderReader
public MailboxReader createNestedMailFolderReader(String url, MailboxReaderFactory.Mode mode) throws MailException Description copied from interface:MailboxReaderFactory
Creates a mail reader, that goes through all messages of the folder specified by theurl
argument and all its subfolders. Theurl
must contain all information to connect to the mailbox. By default the protocols pop3 and imap are supported. For example, aurl
might look like this:imap://your.name%40gmail.com:password@imap.gmail.com:143/INBOX
Note, that the url must be x-www-form-urlencoded.- Specified by:
createNestedMailFolderReader
in interfaceMailboxReaderFactory
- Throws:
MailException
-
createDirectoryReader
Description copied from interface:MailboxReaderFactory
Create a mailbox reader that reads in emails in a local directory. If a `pattern` is specified, the filename (without path) is glob-matched against it and only those that pass are read. It may be for example '*.eml' to only read files with eml extension.- Specified by:
createDirectoryReader
in interfaceMailboxReaderFactory
-