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