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

Example

The code fragment that follows shows two ways to produce the same results. They both write two header lines to the message:


mtaEnqueueWrite(nq, "From: sue@siroe.com\n", 0, NULL);
mtaEnqueueWrite(nq, "Subject: test\n", 0, NULL);


mtaEnqueueWrite(nq, "From: sue@siroe.com\nSubject: test\n", 0,
                NULL);

The following code fragment shows the two header lines output by each code fragment in the preceding code example.


 From: sue@siroe.com
Subject: test

This code fragment demonstrates how to terminate the message header by writing a blank line.

mtaEnqueueWrite(nq, "\n", 0, NULL);

The following code fragment shows a single call to mtaEnqueueWrite()that writes out an entire header, including the terminating blank line.


mtaEnqueueWrite(nq, "Date: today\nFrom: sue@siroe.com\n"
                    "To: bob@siroe.com\nSubject: test\n\n", 0,
                    NULL);

The following code example shows an alternate way of writing the routine call, but with one pair per line.


mtaEnqueueWrite(nq, "Date: today\n", 0,
                    "From: sue@siroe.com\n", 0,
                    "To: bob@siroe.com\n", 0,
                    "Subject: test\n", 0,
                    "\n", 0,
                    NULL);