1mail::Header::mime(3x) Creating headers mail::Header::mime(3x)
2
3
4
6 mail::Header::mime - A structured MIME header.
7
9 #include <libmail/headers.H>
10
11 mail::Header::mime content_type("Content-Type", "text/plain");
12
13 content_type.parameters.set_simple("charset", "iso-8859-1");
14
15 mail::Header::mime content_disposition("Content-Disposition", "attachment")
16 ("filename", "document.doc")
17 ("name", "Monthly Sales", "iso-8859-1", "EN");
18
19 std::cout << content_type.toString();
20
22 This class creates a structured MIME header. A structured MIME header,
23 like Content-Type or Content-Disposition contains a literal value, and
24 zero or more ``name=setting'' parameters, separated by semicolons.
25
26 Two arguments are provided to the constructor, the header's name, and
27 its literal value. After constructing, use the parameters member to
28 set the parameters. This member has the following methods:
29
30 set_simple(std::string name, std::string value)
31 Set parameter name to value. value must contain US-ASCII text
32 only.
33
34 set(std::string name, std::string value, std::string charset,
35 std::string language)
36 Set parameter name to value. charset specifies value's charac‐
37 ter set. language is optional, and specifies value's language.
38 value is converted to US-ASCII text according to RFC 2231.
39
40 erase(std::string name)
41 Remove parameter name.
42
43 The toString() returns the header as a single text string: ``name:
44 value''. Long headers are folded accordingly.
45
46 DYNAMIC PARAMETER GENERATION
47 Parameters can also be dynamically populated by repeatedly calling the
48 ``()''.
49
50 One version of the ``()'' operator receives the parameter name and
51 value, and corresponds to the set_simple method. The second version
52 also receives the character set and language information, and corre‐
53 sponds to the set function.
54
56 mail::Header::addresslist(3x), mail::Header::encoded(3x),
57 mail::Header::list(3x), mail::Header::plain(3x).
58
59
60
61 10 April 2006 mail::Header::mime(3x)