1 Cone©
2
3MAIL::EMAILADDRESS(3x) Cone: COnsole Newsreader And E MAIL::EMAILADDRESS(3x)
4
5
6
8 mail::emailAddress - An E-mail address
9
11 #include <libmail/rfcaddr.H>
12
13 mail::emailAddress address;
14
15 bool errflag;
16
17 address.setDisplayName("Jóse Smith", "iso-8859-1");
18 address.setDisplayAddr("josesmith@example.com", "utf-8");
19
20 std::string addr=address.getDisplayAddr("utf-8");
21 std::string addr=address.getDisplayAddr("utf-8", errflag);
22 std::string name=address.getDisplayName("utf-8");
23 std::string name=address.getDisplayName("utf-8", errflag);
24
25 address.setAddr(addr);
26 address.setDisplayName(name, "utf-8");
27
28
30 mail::emailAddress is a subclass of mail::address that defines four new
31 methods: getDisplayName(), setDisplayName(), getDisplayAddr() and
32 setDisplayAddr(), which retrieve or set the name and the address
33 components of an E-mail address specified in a native character set.
34 mail::emailAddress can be constructed from an existing mail::address;
35 or, the default constructor initializes an empty address, then use
36 setDisplayName() and setDisplayAddr() to set the address structure.
37 setDisplayName() and setDisplayAddr() return an empty string if the
38 display name or address was succesfully mapped from the native
39 character, or an error message.
40
41 The overloaded methods that take a boolean flag will initialize it to
42 indicate if the address contains characters that do not exist in the
43 specified character set.
44
45 Non-Latin characters in the name component use MIME encoding. Passing
46 the name component to setDisplayName() MIME-encodes it using RFC 2047
47 and stores the encoded name in the mail::address superclass.
48 setDisplayAddr() encoded non-Latin characters in the domain portion of
49 the address using IDNA encoding. getDisplayName() and getDisplayAddr()
50 retrieve the name or the address portion from the mail::address
51 superclass, and decode it into the native character set, accordingly.
52
53 For most purposes, using mail::emailAddress is preferrable to using
54 mail::address. mail::address's getName(), setName(), getAddr() and
55 setAddr() methods deal with the raw, MIME-encoded format of E-mail
56 addresses. This structure lets the application deal with human-readable
57 representation of the email address.
58
59 Convert a native name to its MIME-encoded format by using
60 setDisplayName() followed by getName(). Similarly, decode a
61 MIME-encoded name by using setName() followed by getDisplayName().
62
63 Convert an email address to its IDNA-encoded format by using
64 setDisplayAddr() followed by getAddr(). Similarly, decode an
65 IDNA-encoded name by using setAddr() followed by getDisplayAddr().
66
67 The toString and fromString methods are templates, and may be used with
68 a vector of mail::emailAddress or mail::address objects. The two
69 classes are completely interchangable. A mail::emailAddress object may
70 be assigned or converted to a mail::address, and vice-versa.
71
73 mail::address(3x), mail::setappcharset(3x).
74
76 Sam Varshavchik
77
78
79
80Cone© 08/25/2016 MAIL::EMAILADDRESS(3x)