Header (filter)

From Mailutils
Revision as of 14:26, 15 December 2010 by Gray (talk | contribs) (Initial revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The header filter regards the input as a RFC-822 email message and copies to the output the its header part (i.e. everything up to the first empty line). It operates only in decode mode.

An example of its usage:

  int rc;          /* Return code */
  mu_stream_t flt; /* Filter stream */
  mu_stream_t input; /* Input stream */

  initialize_input_stream (&stream);
  rc = mu_filter_stream_create (&flt, input, "header", MU_FILTER_DECODE, MU_STREAM_READ);

Input lines must be separated by single "\n" (LF) characters. If you want this filter to operate on CRLF-separated lines, chain it with a CRLF filter, as shown in the example below:

  int rc;          /* Return code */
  mu_stream_t flt; /* Filter stream */
  char *argv[] = { "CRLF", "+", "header", NULL };

  rc = mu_filter_chain_create (&flt, input, MU_FILTER_DECODE, MU_STREAM_READ, 3, argv);

See also