Skip to main content

Creating an Email Message

Creating an Email Message

To create an email message, do the following:

  1. Create an instance of %Net.MailMessageOpens in a new tab.

    Tip:

    You can specify a character set as the argument to %New(); if you do so, that sets the Charset property for the message.

    For information on character sets and translation tables, see Translation Tables.

  2. Set the To, From, and Subject properties of your instance. These properties are required.

    • To—The list of email addresses to which this message will be sent. This property is a standard InterSystems IRIS list; to work with it, you use the standard list methods: Insert(), GetAt(), RemoveAt(), Count(), and Clear().

    • From—The email address this message is sent from.

    • Subject—The subject of the message.

  3. Optionally set Date, Cc, Bcc, and other properties. For details, see Basic Headers.

  4. If you are creating a single-part message, specify the contents and headers as described in Specifying the Content and Headers of a Message Part.

  5. Or, if you are creating a multipart message, do the following:

    1. Set the IsMultiPart property to 1.

    2. Set the MultiPartType property to one of the following: "related", "alternative", or "mixed".

    3. For each part that the message should contain, create an instance of %Net.MailMessagePartOpens in a new tab. Then specify the contents and headers as described in Specifying the Content and Headers of a Message Part.

    4. For the parent email message, set the Parts property, which is an array. Insert each child message part into this array.

FeedbackOpens in a new tab