1MAIL::ADDRESS(3x)       Cone: COnsole Newsreader And E       MAIL::ADDRESS(3x)
2
3
4

NAME

6       mail::address - An E-mail address
7

SYNOPSIS

9       #include <libmail/rfcaddr.H>
10
11       mail::address address("John Smith", "johnsmith@example.com");
12
13       std::string addr=address.getAddr();
14       std::string name=address.getName();
15
16       address.setAddr(addr);
17       address.setName(name);
18
19       std::string str=address.toString();
20
21       std::vector<mail::address> addressList;
22
23       std::string header= mail::address::toString("From: ", addressList,
24                                                   size_t width=76);
25
26       size_t errorIndex;
27
28       bool error=mail::address::fromString(std::string addresses,
29                                            addressList,
30                                            errorIndex);
31
32       std::string stdAddr=address.getCanonAddress();
33
34       mail::address addr1, addr2;
35
36       bool same= addr1 == addr2;
37       bool notsame= addr1 != addr2;
38

USAGE

40       mail::address represents a single E-mail address. An E-mail address
41       consists of the recipient´s name, and the actual address in the format
42       of user@domain. The name and the address components may be accessed or
43       changed by getName(), getAddr(), setName() and setAddr() methods.
44
45           Note
46           mail::emailAddress would be a more appropriate class for most
47           situations. The name component used by getName() and setName()
48           methods is the Internet-format, MIME-encoded name.
49           mail::emailAddress is a subclass of mail::address, and provides
50           more convenient methods for working with the name component of an
51           E-mail address.
52
53           The toString and fromString methods, defined below, will take a
54           vector of either mail::emailAddress or mail::address objects, and
55           in all other ways both classes are freely interchangable, and may
56           be converted to one another.
57
58       The toString method converts an address to a text string formatted as
59       "name <user@domain>". A second toString function creates an E-mail
60       header that contains a comma-separated list of E-mail addresses. The
61       first parameter must be the header´s name (with a trailing space
62       character); the second parameter is a reference to a vector of
63       mail::address objects. An optional third parameter sets the maximum
64       line width; the text string returned by toString will have newline
65       characters, if necessary to make sure that each line is shorter than
66       the specified maximum.
67
68       fromString does the opposite: it converts the contents of an E-mail
69       header to an array of mail::address objects. The first parameter is the
70       E-mail header´s contents (without Header-Name:). The second parameter
71       is a reference to a vector of mail::address objects.  fromString
72       returns false if a fatal error has occured (out of memory, or something
73       else).  errorIndex is normally set to string::npos. If the header
74       cannot be parsed; errorIndex is set to the index of the character in
75       addresses where a syntax error was found (the header is still parsed,
76       and any recognizable addresses are still saved in addressList).
77
78       addressList should be empty. Otherwise the addresses are appended to
79       addressList´s existing contents.
80
81   Comparing addresses
82       The domain part of an E-mail address is case insensitive, however the
83       user part of an E-mail address is not case insensitive. It is up to
84       each individual domain whether or not the user part is case sensitive,
85       or not. Since it is not possible to determine whether user is case
86       sensitive; the getCanonAddress method returns the E-mail address as
87       user@domain, with only the domain part converted to lowercase.
88
89       The object also defines the equality and non-equality operators, which
90       compare the address portion of two mail::address objects (the name
91       portions are ignored), with the domain part of each domain being case
92       insensitive
93

SEE ALSO

95       mail::emailAddress(3x), mail::envelope(3x).
96
97
98
99[FIXME: source]                   05/08/2010                 MAIL::ADDRESS(3x)
Impressum