        Cone©

MAIL::HEADER::MIME(3x)

NAME
mail::Header::mime - A structured MIME header.

SYNOPSIS

#include <libmail/headers.H>
mail::Header::mime content_type("Content-Type", "text/plain");
    content_type.parameters.set_simple("charset", "iso-8859-1");
mail::Header::mime content_disposition("Content-Disposition", "attachment")
                              ("filename", "document.doc")
                              ("name", "Monthly Sales", "iso-8859-1", "EN");
std::cout << content_type.toString();

USAGE

This class creates a structured MIME header. A structured MIME header, like Content-Type or Content-Disposition contains a literal value, and zero or more “name=setting” parameters, separated by semicolons.

Two arguments are provided to the constructor, the header's name, and its literal value. After constructing, use the parameters member to set the parameters. This member has the following methods:

set_simple(std::string name, std::string value)
    Set parameter name to value. value must contain US-ASCII text only.

set(std::string name, std::string value, std::string charset, std::string language)
    Set parameter name to value. charset specifies value's character set. language is optional, and specifies value's language. value is converted to US-ASCII text according to RFC 2231[1].

erase(std::string name)
    Remove parameter name.

The toString() returns the header as a single text string: “name: value”. Long headers are folded accordingly.

  Dynamic parameter generation

Parameters can also be dynamically populated by repeatedly calling the “()”.

One version of the “()” operator receives the parameter name and value, and corresponds to the set_simple method. The second version also receives the character set and language information, and corresponds to the set function.

SEE ALSO

mail::Header::addresslist(3x), mail::Header::encoded(3x), mail::Header::list(3x), mail::Header::plain(3x).

AUTHOR

Sam Varshavchik

NOTES

1.  RFC 2231
    http://www.rfc-editor.org/rfc/rfc2231.txt