mail::emailAddress — An E-mail address
#include <libmail/rfcaddr.H>
mail::emailAddress address("Jóse Smith", "josesmith@example.com");
std::string addr=address.getAddr();
std::string name=address.getAddrName();
address.setAddr(addr);
address.setAddrName(name);
mail::emailAddress is a
subclass of mail::address
that defines two new methods: getAddrName()
, setAddrName()
, which retrieve or set the
name component of an E-mail address using the native
character set. For most purposes, using mail::emailAddress is preferrable to
using mail::address.
mail::address's getName()
and setName()
methods deal with the raw,
MIME-encoded format of E-mail address names (see RFC 2047).
Convert a native name to its MIME-encoded format by using
setAddrName()
followed by
getName()
. Similarly, decoded a
MIME-encoded name by using setName()
followed by getAddrName()
.
The toString
and
fromString
methods are
templates, and may be used with a vector of mail::emailAddress or mail::address objects. The two classes
are completely interchangable. A mail::emailAddress object may be assigned
or converted to a mail::address, and vice-versa.