Sun Java System Messaging Server 6 2005Q4 MTA Developer's Reference

Sending a Message

Each message sent with mtaSend() must have a corresponding item list describing the message. The entries in this item list specify the message’s From: and To: addresses as well as input sources for the content of the message.

The basic steps in sending a message with mtaSend() are:

  1. Build an item list to pass to mtaSend().

    To build an item list, complete the following steps:

    1. Specify any special processing options, such as MTA_BLANK, or MTA_IGNORE_ERRORS.

    2. Specify the message’s envelope From: address with the MTA_USER item.

    3. Specify the message’s To:, Cc:, and Bcc: addresses with the MTA_TO, MTA_CC, and MTA_BCC items.

    4. Specify an initial message header in one of two ways:

    5. Specify the input sources for the message body with the MTA_MSG_FILE or MTA_MSG_PROC items.

    6. Terminate the item list with an item code of value 0 (MTA_END_LIST).

  2. Pass the item list to mtaSend().

  3. Check the return status from mtaSend().

    For a description of all item codes and their return status values, see Chapter 8, mtaSend() Routine Specification.

To enqueue additional messages, simply repeat these steps.