public function findBody($subtype = null) { $this->buildMimeIds(); foreach ($this->partIterator() as $val) { $id = $val->getMimeId(); if ($val->getPrimaryType() == 'text' && (intval($id) === 1 || !$this->getMimeId()) && (is_null($subtype) || $val->getSubType() == $subtype) && $val->getDisposition() !== 'attachment') { return $id; } } return null; }
protected function _isAttachment($part) { if ($part->getDisposition() == 'attachment') { return true; } $id = $part->getMimeId(); $mime_type = $part->getType(); switch ($mime_type) { case 'text/plain': if (!($this->_part->findBody('plain') == $id)) { return true; } return false; case 'text/html': if (!($this->_part->findBody('html') == $id)) { return true; } return false; case 'application/pkcs7-signature': case 'application/x-pkcs7-signature': return false; } list($ptype, ) = explode('/', $mime_type, 2); switch ($ptype) { case 'message': return in_array($mime_type, array('message/rfc822', 'message/disposition-notification')); case 'multipart': return false; default: return true; } }