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 To: or the Cc: 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: name: value. 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 () operator.

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