Example #1
0
 /**
  * @return string
  */
 public function EncodedValue()
 {
     $sResult = $this->sFullValue;
     if ($this->IsSubject()) {
         if (!\MailSo\Base\Utils::IsAscii($sResult) && \MailSo\Base\Utils::IsIconvSupported() && \function_exists('iconv_mime_encode')) {
             $aPreferences = array('scheme' => \MailSo\Base\Enumerations\Encoding::BASE64_SHORT, 'input-charset' => \MailSo\Base\Enumerations\Charset::UTF_8, 'output-charset' => \MailSo\Base\Enumerations\Charset::UTF_8, 'line-length' => \MailSo\Mime\Enumerations\Constants::LINE_LENGTH, 'line-break-chars' => \MailSo\Mime\Enumerations\Constants::CRLF);
             return \iconv_mime_encode($this->Name(), $sResult, $aPreferences);
         }
     } else {
         if ($this->IsParameterized() && $this->oParameters && 0 < $this->oParameters->Count()) {
             $sResult = $this->sValue . '; ' . $this->oParameters->ToString(true);
         } else {
             if ($this->IsEmail()) {
                 $oEmailCollection = \MailSo\Mime\EmailCollection::NewInstance($this->sFullValue);
                 if ($oEmailCollection && 0 < $oEmailCollection->Count()) {
                     $sResult = $oEmailCollection->ToString(true, false);
                 }
             }
         }
     }
     return $this->NameWithDelimitrom() . $this->wordWrapHelper($sResult);
 }
Example #2
0
 /**
  * @param \MailSo\Mime\Part $oIncPart
  *
  * @return \MailSo\Mime\Part
  */
 private function createNewMessageMixedBody($oIncPart)
 {
     $oResultPart = null;
     $aAttachments = $this->oAttachmentCollection->UnlinkedAttachments();
     if (0 < count($aAttachments)) {
         $oResultPart = Part::NewInstance();
         $oResultPart->Headers->AddByName(\MailSo\Mime\Enumerations\Header::CONTENT_TYPE, \MailSo\Mime\Enumerations\MimeType::MULTIPART_MIXED . '; ' . 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;
 }
Example #3
0
 /**
  *
  *
  * @param string $key
  * @return mixed
  * @throws \DomainException
  */
 protected function getParameter($key)
 {
     return $this->parameters->get($key);
 }