Drafts Script Reference
    Preparing search index...

    Class Message

    The Message object can be used to create and send mail iMessages, similar to those created by a "Message" action step.

    let msg = Message.create();
    msg.toRecipients = ["joe@sample.com"];
    msg.subject = "My test message";
    msg.body = "Body text";

    let success = msg.send();
    Index

    Constructors

    Properties

    body: string

    Body text of the mail message.

    isSent: boolean

    true/false flag indicated if the message object has already been sent.

    status:
        | "created"
        | "sent"
        | "userCancelled"
        | "unknownError"
        | "messagesUnavailable"

    One of the following strings

    • created: Initial value before send() has been called.
    • sent: The message was sent successfully.
    • messagesUnavailable: On iOS, Mail.app services were not available.
    • userCancelled: The user cancelled the Mail.app window without sending.
    • unknownError: An unknown error occurred.
    subject: string

    Subject line. Only used if subject is enabled in Messages settings on the device.

    toRecipients: string[]

    Array of phone numbers and email addresses to use as To: recipients.

    Methods

    • Send the message. This will open the Messages.app sending window. Returns true if the message was sent successfully or false if not - if, for example, the user cancelled the message window.

      Returns boolean