Ejemplo n.º 1
0
 /**
  * @param MimePart $mimePart
  */
 function AddToCollection(&$mimePart, $force = false)
 {
     if ($force || $mimePart->IsMimePartTextBody()) {
         if ($mimePart->IsMimePartAttachment()) {
             return;
         }
         $contentType = strtolower($mimePart->GetContentType());
         $charset = new HeaderParameterCollection($contentType);
         $charset = $charset->GetByName(MIMEConst_CharsetLower);
         $contentCharset = $charset ? $charset->Value : '';
         if ($GLOBALS[MailInputCharset] === '') {
             $GLOBALS[MailInputCharset] = $contentCharset;
             $this->HasCharset = $contentCharset;
             if (null === $this->_charset) {
                 $this->_charset = $contentCharset;
             }
         } else {
             if (null === $this->_charset) {
                 $this->_charset = $GLOBALS[MailInputCharset];
             }
         }
         if (strpos($contentType, MIMETypeConst_TextPlain) !== false || $contentType === '') {
             $this->PlainTextBodyPart .= trim($mimePart->GetBody(MIMEConst_TrimBodyLen_Bytes));
         } else {
             if (strpos($contentType, MIMETypeConst_TextHtml) !== false) {
                 $preStr = '/(<meta\\s.*)(charset\\s?=)([^"\'>\\s]*)/i';
                 $this->HtmlTextBodyPart .= trim(preg_replace($preStr, '$1$2' . $GLOBALS[MailOutputCharset], $mimePart->GetBody(MIMEConst_TrimBodyLen_Bytes)));
             } else {
                 if ($force) {
                     $this->PlainTextBodyPart .= trim($mimePart->GetBody(MIMEConst_TrimBodyLen_Bytes));
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Gets the content type of the attachment.
  * @return string
  */
 function GetContentType()
 {
     return $this->MimePart->GetContentType();
 }