Sending Emails
The mail module adds the ability to send mail to the BoxLang runtime
The mail ( bx-mail
) module adds the ability to send mail to the BoxLang runtime
BoxLang gives you the mail
tag/construct to easily send email in text or HTML format without ceremony. Just register your mail servers in the administrators or the Application.bx
and you are ready to start sending emails in a jiffy!
Query Binding
You can even bind the mail construct with a query, and the engine will send as many emails as rows in the query for you:
Sending Attachments
You can also send attachments to your email destinations very easily using the mimeattach
attribute or via the child mailparam()
construct, which allows you to send multiple attachments or headers.
This module contributes the following Components to the language:
mail
- the wrapping component for a mail operationThe following attributes are available to the
mail
componentfrom
- Sender email addressto
- Comma-delimited list of recipient email addressescharset
- The character encoding of the emailsubject
- The email subjectserver
- Optional SMTP server addressport
- Optional SMTP server portusername
- Optional SMTP usernamepassword
- Optional SMTP passworduseSSL
- Optional true|false for SMTP ConnectionuseTLS
- true|false for SMTP TLS Connectionmailerid
- The header ID of the mailermimeAttach
- path of file to attachtype
- MIME type of the emailwrapText
- Wrap text after a certain number of characters has been reachedsign
- true|false Whether to sign the mail message - requires keystore, keystorePassword, keyAlias, keyPasswordkeystore
- The location of the keystore (Used when signing)keystorePassword
- The password of the keystore (Used when signing)keyAlias
- The alias of the private key to use for signing (Used when signing)keyPassword
The password for the private key within the keystore (Used when signing)encrypt
- true|false Whether to encrypt the mail message - requires recipientCert, encryptionAlgorithmrecipientCert
- The path to the public key certificate of the recipient (Used when encrypting)encryptionAlgorithm
- The encryption algorithm to use (Used when encrypting). One of DES_EDE3_CBC, RC2_CBC, AES128_CBC, AES192_CBC, AES256_CBCdebug
- true|false Whether to enable debug logging output
mailparam
- the component which supplies a mail parameter to the operation, such as headers or filesThe following attributes are available to the
mailparam
componentname
- The header name ( if applicable )value
- The header value ( if applicable )contentID
- The content ID ( optional content id)disposition
- The disposition type (inline
orattachment
- if applicable )file
- The file path of an attachment ( if applicable )fileName
- An optional name of the file to be sent as an attachment ( if applicable )type
- The media type ( if applicable )
mailpart
- the component which supplies a message part ( e.g. "text", "html", etc ) to the mail operationThe following attributes are available to the
mailpart
componenttype
- The mime type of the mail partcharset
- The character encoding of the mail partwrapText
- The number of characters to wrap the mail part at
Configuration
Mail server connectivity may be provided either via runtime configuration ( e.g. .boxlang.json
) or via the attributes allowed by the mail component ( see above ). An example configuration is provided below:
Last updated