libEtPan! API
Prev | Chapter 3. Internet Message Format | Next

# Rendering of messages

## Header fields

    #include <libetpan/libetpan.h>

    int mailimf_fields_write(FILE * f, int * col,
        struct mailimf_fields * fields);

    int mailimf_envelope_fields_write(FILE * f, int * col,
        struct mailimf_fields * fields);

    int mailimf_field_write(FILE * f, int * col,
        struct mailimf_field * field);

- col current column is given for wrapping purpose in (* col), the resulting columns will be returned..

- f is the file descriptor. It can be stdout for example.

- fields is the header fields (see the Section called mailimf_fields - list of header fields).

- field is a field (see the Section called mailimf_field - header field).

mailimf_fields_write outputs the set of header fields.

mailimf_envelope_fields_write outputs the set of header fields except the optional fields.

mailimf_field_write outputs a header.

Example 3-46. rendering of fields

    int main(int argc, char ** argv)
    {
      struct mailimf_fields * fields;
      int col;

      /* look at the example in mailimf_fields to see how to
         build a mailimf_fields */
      fields = build_imf_fields();

      col = 0;
      mailimf_fields_write(stdout, &col, fields);

      mailimf_fields_free(fields);
    }

    int main(int argc, char ** argv)
    {
      struct mailimf_fields * fields;
      int col;

      /* look at the example in mailimf_fields to see how to
         build a mailimf_fields */
      fields = build_imf_fields();

      col = 0;
      mailimf_envelope_fields_write(stdout, &col, fields);

      mailimf_fields_free(fields);
    }

    int main(int argc, char ** argv)
    {
      struct mailimf_field * field;
      int col;

      field = mailimf_field_new_custom(strdup("X-Mailer"), strdup("my mailer"));

      col = 0;
      mailimf_field_write(stdout, &col, field);

      mailimf_field_free(field);
    }

Prev | Home | Next
Creation functions | Up | MIME