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

Originating Messages

Messages enqueued to the MTA fall into one of two broad classes: new messages being originated and messages which were originated elsewhere and which are being transferred into the MTA. The former are typically the product of a local user agent or utility which uses the MTA SDK. The latter are generated by remote user agents, and received by local programs such as SMTP or HTTP servers which then enqueue them to the MTA for routing or delivery or both. In either case, it is the job of the MTA to route the message to its destination, be it a local message store or a remote MTA.

The only distinction the MTA SDK makes between these two cases occurs when the message’s recipient addresses are specified. For new messages being originated, the recipient addresses should be added to both the message’s header and its envelope. For messages originated elsewhere, the recipient addresses should only be added to the message’s envelope. For a discussion of messages originated elsewhere, see Transferring Messages into the MTA, and Intermediate Processing Channels.

When originating a new message, it is easiest to use the MTA_TO, MTA_CC, and MTA_BCC item codes with mtaEnqueueTo(). That tells the SDK to use the specified addresses as both the envelope recipient list and to put them into the message’s header. When using this approach, do not specify any From:, To:, Cc:, or Bcc: header lines in the supplied message’s header; the SDK will add them automatically.

An example of using this approach is found in the section that follows.