/** * @param \MailSo\Mime\Part $oIncPart * * @return \MailSo\Mime\Part */ private function createNewMessageRelatedBody($oIncPart) { $oResultPart = null; $aAttachments = $this->oAttachmentCollection->LinkedAttachments(); if (0 < count($aAttachments)) { $oResultPart = Part::NewInstance(); $oResultPart->Headers->Add(Header::NewInstance(\MailSo\Mime\Enumerations\Header::CONTENT_TYPE, \MailSo\Mime\Enumerations\MimeType::MULTIPART_RELATED . '; ' . ParameterCollection::NewInstance()->Add(Parameter::NewInstance(\MailSo\Mime\Enumerations\Parameter::BOUNDARY, $this->generateNewBoundary()))->ToString())); $oResultPart->SubParts->Add($oIncPart); foreach ($aAttachments as $oAttachment) { $oResultPart->SubParts->Add($this->createNewMessageAttachmentBody($oAttachment)); } } else { $oResultPart = $oIncPart; } return $oResultPart; }
/** * @param string $sName * @param string $sValue * @param bool $bToTop = false * * @return \MailSo\Mime\HeaderCollection * * @throws \MailSo\Base\Exceptions\InvalidArgumentException */ public function SetByName($sName, $sValue, $bToTop = false) { return $this->RemoveByName($sName)->Add(Header::NewInstance($sName, $sValue), $bToTop); }