Sending messages requires you to assemble an instance of Mail and feeding it to the sendMessage() operation.
Operations
sendMessage
ParameterTypesDirectionDescriptionconnection(25.1) JavaMail Library Reference#ConnectioninSpecify the Connection object defining the mail server connection parameters to use (see (25.1) Mail Server Connection).mail(25.1) JavaMail Library Reference#MailinPrepare a mail object to send.
sendPgpMessage
Requires IPgpKeyProvider ImplementationFor PGP encryption to work, be sure to register your implementation of IPgpKeyProvider (see (25.1) Keys and Certificates). ParameterTypesDirectionDescriptionAllowed Values / Exampleconnection(25.1) JavaMail Library Reference#ConnectioninSpecify the Connection object defining the mail server connection parameters to use (see (25.1) Mail Server Connection).mail(25.1) JavaMail Library Reference#MailinPrepare a mail object to send.encryptionMode StringinSpecify one of the encryption modes.PREFERApply encryption when PGP keys can be retrieved (see (25.1) Keys and Certificates), otherwise do not apply any encryption.ENFORCEApply encryption when PGP keys can be retrieved, otherwise throw an exception.NONEDo not apply any encryption (default, same behavior as sendMessage()).
Types
Mail
Attribute NameTypeDescriptionsenderStringProvide the email address of the sender.Sending MessagesSome 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 (25.1) JavaMail Library Reference#AttachmentProvide an array of email attachments.plainTextContentStringProvide 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.htmlTextContentStringProvide 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.
Attachment
Adding inline images to HTML emails is an art form. Be prepared to see different results depending on the client application receiving your message. Make sure to test your HTML code thoroughly to get good results.
Also, sending large images inline is considered bad style as it blows up message size considerably and could be replaced with links to online locations of the image (e.g. a CDN or publicly accessible web server).
Attribute NameTypeDescriptionPossible ValuesbinaryBooleanIndicates 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 NULLSending MessagesThis 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 (25.1) File System Adapter instead, and provide the attachment as binary blob content (see binaryContent).binaryContentBlobContains the binary content.any BlobEither one of binaryContent or stringContent is provided, depending on binary.stringContentStringContains the non-binary content.any StringEither 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.