immd_read_header - Write text to a message being enqueued.
#include <imta.h>
int immd_read_header(immd_t md, imhdr_t *hdr);
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.
immd_read_header() return IMRC_OK when successful, and one of the following error codes upon failure:
A textual explanation of the failure can be obtained by calling imta_error() immediately afterwards.
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)