#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();
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 parameter name to value. value must contain US-ASCII text only.
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.
Remove parameter name.
The toString() returns the header as a single text string: "name: value". Long headers are folded accordingly.
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.
mail::Header::addresslist(3x), mail::Header::encoded(3x), mail::Header::list(3x), mail::Header::plain(3x).
<<< Previous | Home | Next >>> |
mail::Header::list | Up | mail::Header::plain |