/** * Adds $part to the list of parts and returns the Content-ID of the part. * * @param ezcMailPart $part * @return string */ public function addRelatedPart(ezcMailPart $part) { // it doesn't have a Content-ID, we must set one. $contentId = ''; if ($part->getHeader('Content-ID') == '') { if ($part instanceof ezcMailFile) { $part->contentId = ezcMailTools::generateContentId(basename($part->fileName)); } else { $part->setHeader('Content-ID', ezcMailTools::generateContentId('part')); } } $contentId = trim($part->getHeader('Content-ID'), '<>'); // Set the content ID property of the ezcMailFile if one was found if ($part instanceof ezcMailFile) { $part->contentId = $contentId; } if (count($this->parts) > 0) { $this->parts[] = $part; } else { $this->parts[1] = $part; } return $contentId; }