• Public
  • Public/Protected
  • All

Namespace Message


Type Aliases

MsgType: "text/plain" | "text/html"
RecipientType: "BCC" | "CC" | "TO"


msgType: IMsgTypeCollection = ...

A map of the email message body types. Email messages can contain multiple content types allowing a client application the option to display the content it is best suited to handle. A common practice is to include both plain and html body types to allow applications which cannot render html content to display a plain text version.

recipientType: IRecipientTypeCollection = ...

A map of the email recipient types.


  • A utility function to create a recipient object (based on a user ID or group ID) used in sendMessage. Note: only server side validation or transformation scripts can specify a user or group ID.


    • type: RecipientType

      Determines where the recipient email address will appear in the message.

    • principalId: number

      The user or group id of the recipient.

    Returns IPrincipalRecipient

  • Sends an email notification message through the LabKey Server. Message recipients and the sender must exist as valid accounts, or the current user account must have permission to send to addresses not associated with a LabKey Server account at the site-level, or an error will be thrown.

    Recipients whose accounts have been deactivated or have never been logged into will be silently dropped from the message.

    function errorHandler(errorInfo, responseObj){
    LABKEY.Utils.displayAjaxErrorResponse(responseObj, errorInfo);

    function onSuccess(result){
    alert('Message sent successfully.');

    msgFrom: 'admin@test.com',
    msgSubject: 'Testing email API...',
    msgRecipients: [
    LABKEY.Message.createRecipient(LABKEY.Message.recipientType.to, 'user1@test.com'),
    LABKEY.Message.createRecipient(LABKEY.Message.recipientType.cc, 'user2@test.com'),
    LABKEY.Message.createRecipient(LABKEY.Message.recipientType.cc, 'user3@test.com'),
    LABKEY.Message.createRecipient(LABKEY.Message.recipientType.bcc, 'user4@test.com')
    msgContent: [
    LABKEY.Message.createMsgContent(LABKEY.Message.msgType.html, '<h2>This is a test message</h2>'),
    LABKEY.Message.createMsgContent(LABKEY.Message.msgType.plain, 'This is a test message')
    success: onSuccess,
    failure: errorHandler,


    Returns XMLHttpRequest

Generated using TypeDoc