mail::Header::addresslist.3x

Langue: en

Autres versions - même langue

Version: 11/28/2008 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

NAME

mail::Header::addresslist - An E-mail header that contains addresses.

SYNOPSIS

 #include <libmail/headers.H>
 
 std::vector<mail::emailAddress> address_list;
 mail::emailAddress addr;
 
 mail::Header::addresslist tohdr("To", address_list);
 
 mail::Header::addresslist cchdr("Cc")("John", "john@example.com")
                                      ("Tom", "tom@example.com")
                                      (addr);
 
 std::cout << tohdr.toString();
 
 

USAGE

This class creates a header that contains addresses, such as the lqTo:rq or the lqCc:rq header. Two arguments are provided to the constructor: the header's name, and a vector containing the addresses.

This is not the appropriate class to create structured MIME headers. Use mail::Header::mime(3x) to create structured MIME headers.

The toString() returns the header as a single text string: lqname: valuerq. Long headers are folded accordingly.

Dynamic address list generation

This class has an alternative constructor that receives a single parameter: the header's name, which initializes an empty address list. The address list is populated by repeatedly calling the lq()rq operator.

One version of the lq()rq operator receives the explicit name and address components of an E-mail address. Alternatively, a mail::emailAddress object may be provided.

SEE ALSO

mail::Header::encoded(3x), mail::Header::list(3x), mail::Header::mime(3x), mail::Header::plain(3x).