libEtPan! API
Prev | Chapter 4. MIME | Next

# Rendering of MIME parts

## mailmime_fields_write, mailmime_content_write and mailmime_content_type_write

    #include <libetpan/libetpan.h>

    int mailmime_fields_write(FILE * f, int * col,
    			  struct mailmime_fields * fields);

    int mailmime_content_write(FILE * f, int * col,
    			   struct mailmime_content * content);

    int mailmime_content_type_write(FILE * f, int * col,
    				struct mailmime_content * content);

mailmime_fields_write render the MIME header fields.

mailmime_content_write render the MIME content type header field.

mailmime_content_write render the content of the MIME content type header 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 mailmime_fields - header fields).

- content is the header fields (see the Section called mailmime_content - MIME content type (Content-Type)).

Example 4-33. rendering MIME header fields

    #include <libetpan/libetpan.h>

    int main(int argc, char ** argv)
    {
      struct mailmime_mime * mime_fields;
      int col;

      /* look at the example in mailmime_fields to see how to
         build a mailmime_fields */
      mime_fields = build_mime_fields();

      col = 0;
      mailmime_fields_write(stdout, &col, mime_fields);

      mailmime_fields_free(mime_fields);
    }

    int main(int argc, char ** argv)
    {
      struct mailmime_content * content;
      int col;

      /* look at the example in mailmime_content to see how to
         build a mailmime_fields */
      content = build_mime_content();

      col = 0;
      mailmime_content_write(stdout, &col, mime_fields);

      mailmime_content_free(content);
    }

    int main(int argc, char ** argv)
    {
      struct mailmime_content * content;
      int col;

      /* look at the example in mailmime_content to see how to
         build a mailmime_fields */
      content = build_mime_content();

      col = 0;
      mailmime_content_type_write(stdout, &col, mime_fields);

      mailmime_content_free(content);
    }

## mailmime_write

    #include <libetpan/libetpan.h>

    int mailmime_write(FILE * f, int * col,
    		   struct mailmime * build_info);

This function will render a MIME message.

- 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.

- build_info is the MIME message to render.

## mailmime_quoted_printable_write and mailmime_base64_write

    #include <libetpan/libetpan.h>

    int mailmime_quoted_printable_write(FILE * f, int * col, int istext,
        const char * text, size_t size);

    int mailmime_base64_write(FILE * f, int * col,
        const char * text, size_t size);

mailmime_quoted_printable_write() will render a string to quoted printable.

mailmime_base64_write() will render a string to base64.

- 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.

- text is the string to render.

- size is the size of the string to render.

Example 4-34. render base64 or quoted printable

    #include <libetpan/libetpan.h>

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

      col = 0;
      mailmime_quoted_printable_write(stdout, &col,
        "this is a test", 14);
    }

    #include <libetpan/libetpan.h>

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

      col = 0;
      mailmime_base64_write(stdout, &col, "this is a test", 14);
    }

## mailmime_data_write

    #include <libetpan/libetpan.h>

    int mailmime_data_write(FILE * f, int * col,
        struct mailmime_data * data,
        int istext);

mailmime_data_write will render MIME data.

- 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.

- data is the data to render (see the Section called mailmime_data - Content of MIME part).

Prev | Home | Next
Parser functions | Up | Creation functions