NAME

     immd_read_header - Write text to a message being enqueued.


SYNOPSIS

     #include <imta.h>

     int immd_read_header(immd_t md, imhdr_t *hdr);


DESCRIPTION

     immd_read_header() will, in a single call, read  the  entire
     message  header  from  a  message  being  dequeued  with the
     dequeue context md.  The "read point" for the  message  must
     be positioned at the start of the outer message header. This
     will be the case  immediately  after  having  retrieved  the
     entire   list   of   recipients,   in   other  words,  after
     immd_get_recipient() has returned 1,  or  immediately  after
     calling immd_rewind().

     Once the header has been  created  with  immd_read_header(),
     the  header  object  can be accessed with the message header
     API calls, e.g.  imhdr_get_line(), or written to  a  message
     being enqueued by calling imme_write_header().  imhdr_free()
     should be called to dispose of a previously read header. See
     the  SDK  guide for details on using and manipulating header
     structures.


RETURN VALUES

     immd_read_header() return IMRC_OK when successful,  and  one
     of the following error codes upon failure:

     IMRC_BAD_CONTEXT
                 The dequeue context md has not been  initialized
                 or  has  been  corrupted.  Make sure immd_init()
                 has been previously called.

     IMRC_NO_ENVELOPE
                 All envelope recipients of the message  must  be
                 read  before starting to write the header.  Keep
                 calling immd_get_recipient() until it returns 1.

     IMRC_HDR_READ
                 The message header has already been read.   Call
                 immd_rewind() prior to reading it again.

     A textual explanation of the failure can be obtained by cal-
     ling imta_error() immediately afterwards.


ATTRIBUTES





               _______________________________________
              |   Attribute Type   |  Attribute Value|
              |____________________|_________________|
              | Architecture       |  sparc, x86     |
              |____________________|_________________|
              | Availability       |  SUNWimsdk      |
              |____________________|_________________|
              | MT-Level           |  MT-Safe        |
              |____________________|_________________|
              | Interface Stability|  Stable         |
              |____________________|_________________|


SEE ALSO

     immd_init(3),     immd_rewind(3),     immd_get_recipient(3),
     imhdr_free(3),    imhdr_get_line(3),   imme_write_header(3),
     immd_read_text(3)