mail::Header::addresslist.3x man page


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


#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")

std::cout << tohdr.toString();


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.

See Also

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


Sam Varshavchik


Cone© Cone: COnsole Newsreader And E 08/25/2013