mail::Header::encoded.3x - Man Page

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[1].

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[2].

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.

See Also

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


Sam Varshavchik


  1. RFC 2047
  2. RFC 2231


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