1 Cone©
2
3MAIL::HEADER::MIME(3x) Cone: COnsole Newsreader And E MAIL::HEADER::MIME(3x)
4
5
6
8 mail::Header::mime - A structured MIME header.
9
11 #include <libmail/headers.H>
12
13 mail::Header::mime content_type("Content-Type", "text/plain");
14
15 content_type.parameters.set_simple("charset", "iso-8859-1");
16
17 mail::Header::mime content_disposition("Content-Disposition", "attachment")
18 ("filename", "document.doc")
19 ("name", "Monthly Sales", "iso-8859-1", "EN");
20
21 std::cout << content_type.toString();
22
23
25 This class creates a structured MIME header. A structured MIME header,
26 like Content-Type or Content-Disposition contains a literal value, and
27 zero or more “name=setting” parameters, separated by semicolons.
28
29 Two arguments are provided to the constructor, the header's name, and
30 its literal value. After constructing, use the parameters member to set
31 the parameters. This member has the following methods:
32
33 set_simple(std::string name, std::string value)
34 Set parameter name to value. value must contain US-ASCII text
35 only.
36
37 set(std::string name, std::string value, std::string charset,
38 std::string language)
39 Set parameter name to value. charset specifies value's character
40 set. language is optional, and specifies value's language. value
41 is converted to US-ASCII text according to RFC 2231[1].
42
43 erase(std::string name)
44 Remove parameter name.
45
46 The toString() returns the header as a single text string: “name:
47 value”. Long headers are folded accordingly.
48
49 Dynamic parameter generation
50 Parameters can also be dynamically populated by repeatedly calling the
51 “()”.
52
53 One version of the “()” operator receives the parameter name and value,
54 and corresponds to the set_simple method. The second version also
55 receives the character set and language information, and corresponds to
56 the set function.
57
59 mail::Header::addresslist(3x), mail::Header::encoded(3x),
60 mail::Header::list(3x), mail::Header::plain(3x).
61
63 Sam Varshavchik
64
66 1. RFC 2231
67 http://www.rfc-editor.org/rfc/rfc2231.txt
68
69
70
71Cone© 08/25/2016 MAIL::HEADER::MIME(3x)