public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator)
{
$this->cacheKey = md5(uniqid(getmypid() . mt_rand(), true));
$this->cache = $cache;
$this->headers = $headers;
$this->idGenerator = $idGenerator;
$this->setEncoder($encoder);
$this->headers->defineOrdering(array('Content-Type', 'Content-Transfer-Encoding'));
// This array specifies that, when the entire MIME document contains
// $compoundLevel, then for each child within $level, if its Content-Type
// is $contentType then it should be treated as if it's level is
// $neededLevel instead. I tried to write that unambiguously! :-\
// Data Structure:
// array (
// $compoundLevel => array(
// $level => array(
// $contentType => $neededLevel
// )
// )
// )
$this->compoundLevelFilters = array(self::LEVEL_ALTERNATIVE + self::LEVEL_RELATED => array(self::LEVEL_ALTERNATIVE => array('text/plain' => self::LEVEL_ALTERNATIVE, 'text/html' => self::LEVEL_RELATED)));
$this->id = $this->idGenerator->generateId();
}