mail::Header::encoded — An unstructured E-mail header.


#include <libmail/headers.H>

mail::Header::encoded encoded_header("Subject", subjectStr, "UTF-8", "EN");

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


This class creates unstructured E-mail header. Three arguments are provided to the constructor: the header's name, its content, and the content's character set. Non-US-ASCII portions of the contents are encoded according to RFC 2047.

The fourth argument to the constructor is optional. If not an empty string, it identifies the content's language, as described in section 5 of RFC 2231.

This is not the appropriate class to create structured MIME headers, or address list headers. Use mail::Header::addresslist(3x) to create headers that contain E-mail addresses. 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 at the nearest whitespace.