Page tree
Skip to end of metadata
Go to start of metadata

On this Page:

Related Pages:

Folder Handling

Operations expecting a folderPath argument will treat this the following way:

Folder PathDescription Example
NULL

This is interpreted as meaning the <Inbox> folder.


path beginning with / This is interpreted as a path from the mail connections root folder./Archive/Orders
path not beginning with /

This is interpreted as a relative path to the <Inbox> folder, so translates to /<Inbox>/Archive/Orders.

Archive/Orders 

The intention of this behavior is to abstract away the fact that <Inbox> has many different names depending on the connection, i.e. IMAP typically uses INBOX, Exchange calls it Inbox, and a German Exchange calls it Posteingang.

Also note that POP3 does not support folders other than <Inbox>. Hence when you specify a POP3 connection, folderPath parameters other than NULL will raise an exception.

Operations

readMessages

ParameterTypeDirectionDescription
connectionConnectioninSpecify the Connection object defining the mail server connection parameters to use (see Mail Server Connection).
flagsReadFlagsinSpecify an instance of ReadFlags to set some mail reading flags.
folderPathStringinSpecify a path to a folder to read from. See note regarding folder handling.

readMessagesFiltered

ParameterTypesDirectionDescription
connectionConnectioninSpecify the Connection object defining the mail server connection parameters to use (see Mail Server Connection).
flagsReadFlagsinSpecify an instance of ReadFlags (see below).
folderPathStringinSpecify a path to a folder to read from. See note regarding folder handling.
filterFilterinSpecify an instance of Filter containing the filter criteria.

deleteMessage

ParameterTypesDirectionDescription
connectionConnectioninSpecify the Connection object defining the mail server connection parameters to use (see Mail Server Connection).
mail

ReceivedMail

inProvide a previously received mail object.

deleteMessages

ParameterTypesDirectionDescription
connectionConnectioninSpecify the Connection object defining the mail server connection parameters to use (see Mail Server Connection).
mail

Array of ReceivedMail

inProvide an array previously received mail object.

deleteMessagesFiltered

ParameterTypesDirectionDescriptionAllowed Values / Example
connectionConnectioninSpecify the Connection object defining the mail server connection parameters to use (see Mail Server Connection).
folderPath

String

inSpecify a path to a folder to delete from. See note regarding folder handling.

orders/incoming

filterFilterinSpecify an instance of Filter containing the filter criteria.

moveMessage

ParameterTypesDirectionDescriptionAllowed Values / Example
connectionConnectioninSpecify the Connection object defining the mail server connection parameters to use (see Mail Server Connection).
mailReceivedMailinProvide an array previously received mail object.
folderPath

String

in

Specify a path to a specific sub-folder to move the message to. See note regarding folder handling.

POP3 connections will cause an exception to be thrown here, as POP3 does not support the concept of folders.

orders/incoming/accepted

sendMessage

ParameterTypesDirectionDescription
connectionConnectioninSpecify the Connection object defining the mail server connection parameters to use (see Mail Server Connection).
mail

Mail

inPrepare a mail object to send.

listFolders

ParameterTypesDirectionDescriptionAllowed Values / Example
connectionConnectioninSpecify the Connection object defining the mail server connection parameters to use (see Mail Server Connection).
parentFolder

String

inSpecify the path to the parent folder. See note regarding folder handling.NULLList folders below <Inbox>.
\List folders below root folder.
a pathList folders below given path.
foldersArray of Stringreturn

Returns a recursive list of sub-folder paths.

  • orders
  • orders/incoming
  • orders/incoming/accepted

existsFolderPath

ParameterTypesDirectionDescriptionAllowed Values / Example
connectionConnectioninSpecify the Connection object defining the mail server connection parameters to use (see Mail Server Connection).
folderPath

String

inSpecify the path to the folder to check. See note regarding folder handling.orders/outgoing
existsBooleanreturn

Returns if the given folder is existent on the mail server.

trueFolder exists.
falseFolder does not exist.

createFolderPath

ParameterTypesDirectionDescriptionAllowed Values / Example
connectionConnectioninSpecify the Connection object defining the mail server connection parameters to use (see Mail Server Connection).
folderPath

String

inSpecify the path to the  folder to be created. See note regarding folder handling.orders/outgoing

deleteFolderPath

ParameterTypesDirectionDescriptionAllowed Values / Example
connectionConnectioninSpecify the Connection object defining the mail server connection parameters to use (see Mail Server Connection).
folderPath

String

inSpecify the path to the  folder to be deleted recursively. See note regarding folder handling.
  • orders/incoming/accepted
    Delete folder accepted from folder incoming.
  • orders
    Delete folder orders and all sub-folders and contents.

loadCertificateStore

ParameterTypesDirectionDescriptionAllowed Values / Example
keyStoreLocationStringinSpecify the path to the  keystore file.opt/bridge/crypto/mailservercerts.jks
keyStorePassword

String

inSpecify the password of the keystore.


loadPgpPublicKeyRing

ParameterTypesDirectionDescriptionAllowed Values / Example
keyRingLocationStringinSpecify the path to the  keyring file.opt/bridge/crypto/pubkeys.asc

Types

Connection

Attribute NameTypeDescriptionAllowed Values
debugBooleanSpecify whether to write additional debug information to the bridgeserver log.trueAdditional debug information is written to the bridgeserver log.
falseNo additional logs (default).
exchangeVersionStringSpecify the Microsoft Exchange version (optional).2007_SP1 Exchange 2007 Service Pack 1
2010Exchange 2010
2010_SP1Exchange 2010 Service Pack 1
2010_SP2Exchange 2010 Service Pack 2 and higher (default)
hostStringSpecify the host name/IP address of the mail server.a valid host name or IP address

for exchange connections this can be left NULL, triggering Autodiscover (which might fail)

for  office365 connections this is ignored

passwordStringSpecify the user's password.a valid passwordSome SMTP servers allow unauthorized sending, in these cases you may leave it as NULL.
portIntegerSpecify the port of the mail server (optional)a valid port numberIf omitted (NULL), the standard port for the chosen protocol and security is used.
protocolString

Specify the protocol used for e-mail retrieval and storage.
Values are not case sensitive.

imapUse the IMAP protocol.
imapsUse IMAP over SSL.
pop3Use POP3.
smtpUse the SMTP protocol.
smtpsUse the SMTPS protocol.
exchangeUse Exchange Web Service (EWS) API with a hosted Exchange Server
office365Use Exchange Web Service (EWS) API with a Office 365 Server (will ignore host).
securityString

Specify the encryption.
Values are not case sensitive.

exchange and office365 protocols ignore this setting and use ssl anyway.

noneNo encryption used.
exchange and office365 protocol (see attribute protocol) use SSL in any case, this cannot be overridden.
ssl

Use SSL encryption. 

starttls

Use TLS encryption.
exchange and office365 protocol (see attribute protocol) use SSL in any case, this cannot be overridden.

Make sure to pick imap, pop3, or smtp with this setting, not imaps, pop3s, or smtps.

timeoutSecondsIntegerSpecify the number of seconds after which a request (send or receive) times out.

any positive integer

Default is 0, which translates to the following defaults:

  • infinite timeout for imap(s), pop3(s), and smtp(s)
  • 100 seconds for exchange
userStringSpecify the user account on the mail server.a valid userSome SMTP servers allow unauthorized sending. In these cases you may leave it as NULL.
verifyHostBooleanSpecify whether for SSL connections the mail server host shall be verified or not (optional).trueVerify the mail server's SSL certificate (default, see also security).
falseDo not verify the mail server.

ReadFlags

Attribute NameTypeDescriptionAllowed ValuesComment
maxResultCountIntegerSpecify a limit for the number of messages to be returned.any positive integer

Default is NULL, meaning no limit is imposed.

If you do not provide a filter as parameter, it makes sense to provide a meaningful limit, as the complete result set will be kept in memory.

deleteOnServerBooleanSpecify whether successfully read messages will automatically be deleted on the server.true

Delete messages on server after successful read. Messages that cannot be read successfully will not be deleted.

falseDo not delete messages on server (default).
withContentBooleanSpecify whether the message body (HTML and/or plain text) should be populated.truePopulate message body.
falseMessage body is empty (default).
withAttachmentsBooleanSpecify whether attachments should be retrieved.trueRetrieve attachments.
falseDo not retrieve attachments (default).
withEmbeddedMailsBooleanSpecify whether attachments with mime type message/rfc822 should be retrieved as embedded messages.trueRetrieve attachments with mime type message/rfc822 as embedded messages.
falseDo not retrieve attachments with mime type message/rfc822 as embedded messages (default).
withHeadersBooleanSpecify whether messaging headers should be populated.truePopulate messaging headers.
falseMessaging headers are empty (default).
withRawContentsBooleanSpecify whether the raw message source should be retrieved.true

Retrieve raw message source.

This is similar to "view source" on most email clients, hence the output can be huge.

falseDo not retrieve raw message source (default).
verifySignaturesBooleanSpecify whether for any signed messages a verification of the signature should be attempted.true

Verify signature.

To successfullly verify PGP signatures, a public key ring must be provided with the connection parameter.

falseDo not verify signature (default).

Filter

Attribute NameTypeDescriptionAllowed Values
unreadOnlyBooleanSpecify whether only unread messages should be returned.trueReturn unread messages only.
falseReturn all messages (default).
fromTimestampDateTime

Specify the beginning of a date range that should be used to retrieve messages (see also toTimestamp below).

Make sure that fromTimestamp and toTimestamp do not contradict eachother as this is not checked.

any DateTime
toTimestampDateTime

Specify the end of a date range that should be used to retrieve messages (see also fromTimestamp below).

Make sure that fromTimestamp and toTimestamp do not contradict eachother as this is not checked.

any DateTime
subjectSubstringString

Specify a filter substring for the email subject. Only messages containing this string as a literal substring are returned.

subjectSubstring is case sensitive.

any String with printable characters (case sensitive)
senderString

Specify a dedicated sender you want to retrieve messages from. Only message sent from this address are returned

any valid email address (case insensitive)
subjectRegexString

Specify a regex filter to be applied to the mail subject. Only messages with the subject matching the filter expression are returned.

any valid regular expression (Java style)
attachmentNameRegexString

Specify a regex filter to be applied to the mail attachments. Only messages with at least one attachment's name matching the filter expression are returned.

Make sure that you are using withAttachments = true when reading the mails (see ReadFlags).

any valid regular expression (Java style)

ReceivedMail

ReceivedMail inherits from Mail, so contains all attributes of Mail plus a few more.

Attribute NameTypeDescriptionPossible Values
senderStringContains the email address of the sender.
toRecipientsArray of StringContains an array of TO recipient's email addresses.
ccRecipientsArray of StringContains an array of CC recipient's email addresses.
bccRecipientsArray of StringContains an array of BCC recipient's email addresses.
subjectStringContains the email subject.
attachmentsArray of AttachmentContains an array of email attachments.

If this is not populated, you may have set withAttachments = false when reading the mails (see ReadFlags).

plainTextContentString

Contains the plain text message if available.

Mime messages may contain HTML, Plain Text, or both.


htmlTextContentString

Contains the HTML message if available.

Mime messages may contain HTML, Plain Text, or both.


idStringContains the unique ID of the message within a folder on the mail server.
receiveDateDateTimeContains a timstamp indicating when the message arrived on the server.
sentDateDateTimeContains a timstamp indicating when the message has been sent.
headersArray of MailHeaderContains an array of internet email headers.
If this is not populated, you may have set withHeaders = false when reading the mails (see ReadFlags).
embeddedMailsArray of ReceivedMailContains an array of nested/embedded mail objects (attached email messages, e.g. .eml or .msg attachments).

If this is not populated, you may have set withAttachments = false when reading the mails (see ReadFlags).

receiveStatusMailReceiveStatusContains detailed information about the receive status of the email.
folderStringContains the folder the message was read from.NULL<Inbox>.
folder pathThe folder path below <Inbox>.
signedBooleanContains the signing status of the message.trueMessage is signed.
falseMessage is not signed.
encryptedBoolean

Contains the encryption status of the message.

detection is supported, however receiveStatus.success will always be false, as decryption is not yet supported

trueMessage is encrypted.
falseMessage is not encrypted.
signatureVerificationResultSignatureVerificationResultContains detailed information about the verification of signatures.


rawMessageTextBlobContains the raw message.

If this is not populated, you may have set withRawContents = false when reading the mails (see ReadFlags).

Attachment

Attribute NameTypeDescriptionPossible Values
binaryBooleanIndicates whether binaryContent or stringContent is used.trueAttachment contents canl be found in, or shall be taken from, binaryContent.
falseAttachment contents can/shall be found in, or shall be taken from, stringContent.
filenameStringThe filename of the attachment.
  • can be NULL

Sending Messages

This is the name of the file as you want it to appear at the recipient's side, or vice versa.

Do not provide a local file name here and expect the library to load the attachment from that file. Use the File System Adapter instead, and provide the attachment as binary blob content (see binaryContent).

binaryContentBlob

Contains the binary content.

any Blob

Either one of binaryContent or stringContent is provided, depending on binary.
stringContentString

Contains the non-binary content.

any String


Either one of binaryContent or stringContent is provided, depending on binary.



mimeTypeStringContains the mime type (content type) of the attachment.

any valid MIME content-type, e.g. text/plain, image/png, application/octet-stream etc.

mimeType is unreliable upon receiving emails, i.e. can be NULL. Especially when reading from Exchange servers using exchange or office365 connections.

contentIdStringThe content id of the attachment, a unique id across all attachments of the same message.When set to e.g. myUniqueId, you can refer to this attachment from HTML message content like <img src="cid:myUniqueId">
inlineBooleanControls whether the attachment is flagged with the corresponding content disposition tag.trueAttachment is flagged, and will be displayed inline within a HTML message.
falseAttachment is not flagged.

MailReceiveStatus

Attribute NameTypeDescriptionPossible Values
successBooleanReturns whether the entire message could be read with all requested attributes (see ReadFlags).trueMessage could be read with all requested attributes.
false

Message could not be read or some requested attributes are missing.

A message will not be deleted if success is false - regardless of what has been specified with deleteOnServer (see ReadFlags).

deletedOnServerBooleanReturns whether the message has been deleted after retrieval.trueMessage has been deleted.
false

Message has not been deleted.

A message will not be deleted if success is false - regardless of what has been specified with deleteOnServer (see ReadFlags).

errorMessageStringReturns further information on the issue if success is false.
stacktraceArray of StringReturns a stacktrace if the problem was caused by an unexpected Java exception.
protocolArray of StringReturns the steps performed while receiving the message as a protocol. This can give a hint in case of problems.

SignatureVerificationResult

Attribute NameTypeDescriptionPossible Values
verifiedBooleanReturns whether the signature is valid or not.trueMessage signature is valid.
false

Message signature is invalid, or no verification has been requested (see verifySignatures in ReadFlags).

errorMessageStringReturns details of a failed verification.

MailHeader

Attribute NameTypeDescriptionPossible Values
nameStringName of the header.
valueStringValue of the header.

Mail

Attribute NameTypeDescriptionPossible Values
senderStringProvide the email address of the sender.

Sending Messages

Some email servers (especially Exchange servers) require this to be the address of the user specified in the connection. They will raise an imposter exception if this is not the case.

toRecipientsArray of StringProvide an array of TO recipient's email addresses.
ccRecipientsArray of StringProvide an array of CC recipient's email addresses.
bccRecipientsArray of StringProvide an array of BCC recipient's email addresses.
subjectStringProvide the email subject.
attachmentsArray of AttachmentProvide an array of email attachments.


plainTextContentString

Provide a plain text message if applicable.

Mime messages allow for multipart/alternative parts. If you specify both plainTextContent and htmlTextContent, the JavaMail library will send both as a multipart/alternative when connecting via SMTP.
EWS does not allow this. So, when sending through Exchange, the library will pick the HTML content if provided.

htmlTextContentString

Provide an HTML message if applicable.

Mime messages allow for multipart/alternative parts. If you specify both plainTextContent and htmlTextContent, the JavaMail library will send both as a multipart/alternative when connecting via SMTP.
EWS does not allow this. So, when sending through Exchange, the library will pick the HTML content if provided.

  • No labels