src/IMAP/Attachment.php
protected function fetch() {

        $content = imap_fetchbody($this->oMessage->getClient()->getConnection(), $this->oMessage->getUid(), $this->part_number, $this->oMessage->getFetchOptions() | FT_UID);

        $this->content_type = $this->type.'/'.strtolower($this->structure->subtype);
        $this->content = $this->oMessage->decodeString($content, $this->structure->encoding);

        if (property_exists($this->structure, 'id')) {
            $this->id = str_replace(['<', '>'], '', $this->structure->id);
        }

        if (property_exists($this->structure, 'dparameters')) {
            foreach ($this->structure->dparameters as $parameter) {
                if (strtolower($parameter->attribute) == "filename") {
                    $this->setName($parameter->value);
                    $this->disposition = property_exists($this->structure, 'disposition') ? $this->structure->disposition : null;
                    break;
                }
            }
        }

        if (IMAP::ATTACHMENT_TYPE_MESSAGE == $this->structure->type) {
            if ($this->structure->ifdescription) {
                $this->setName($this->structure->description);
            } else {
                $this->setName($this->structure->subtype);
            }
        }

        if (!$this->name && property_exists($this->structure, 'parameters')) {
            foreach ($this->structure->parameters as $parameter) {
                if (strtolower($parameter->attribute) == "name") {
                    $this->setName($parameter->value);
                    $this->disposition = property_exists($this->structure, 'disposition') ? $this->structure->disposition : null;
                    break;
                }
            }
        }
    }
protected function fetch() {

        $content = imap_fetchbody($this->oMessage->getClient()->getConnection(), $this->oMessage->getUid(), $this->part_number, $this->oMessage->getFetchOptions() | FT_UID);

        $this->content_type = $this->type.'/'.strtolower($this->structure->subtype);
        $this->content = $this->oMessage->decodeString($content, $this->structure->encoding);

        if (property_exists($this->structure, 'id')) {
            $this->id = str_replace(['<', '>'], '', $this->structure->id);
        }

        if (property_exists($this->structure, 'dparameters')) {
            foreach ($this->structure->dparameters as $parameter) {
                if (strtolower($parameter->attribute) == "filename") {
                    $this->setName($parameter->value);
                    $this->disposition = property_exists($this->structure, 'disposition') ? $this->structure->disposition : null;
                    break;
                }
            }
        }

        if (IMAP::ATTACHMENT_TYPE_MESSAGE == $this->structure->type) {
            if ($this->structure->ifdescription) {
                $this->setName($this->structure->description);
            } else {
                $this->setName($this->structure->subtype);
            }
        }

        if (!$this->name && property_exists($this->structure, 'parameters')) {
            foreach ($this->structure->parameters as $parameter) {
                if (strtolower($parameter->attribute) == "name") {
                    $this->setName($parameter->value);
                    $this->disposition = property_exists($this->structure, 'disposition') ? $this->structure->disposition : null;
                    break;
                }
            }
        }
    }
protected function fetch ( ) { $ content = imap_fetchbody ( $ this -> oMessage -> getClient ( ) -> getConnection ( ) , $ this -> oMessage -> getUid ( ) , $ this -> part_number , $ this -> oMessage -> getFetchOptions ( ) | FT_UID ) ; $ this -> content_type = $ this -> type . '/' . strtolower ( $ this -> structure -> subtype ) ; $ this -> content = $ this -> oMessage -> decodeString ( $ content , $ this -> structure -> encoding ) ; if ( property_exists ( $ this -> structure , 'id' ) ) { $ this -> id = str_replace ( [ '<' , '>' ] , '' , $ this -> structure -> id ) ; } if ( property_exists ( $ this -> structure , 'dparameters' ) ) { foreach ( $ this -> structure -> dparameters as $ parameter ) { if ( strtolower ( $ parameter -> attribute ) == "filename" ) { $ this -> setName ( $ parameter -> value ) ; $ this -> disposition = property_exists ( $ this -> structure , 'disposition' ) ? $ this -> structure -> disposition : null ; break ; } } } if ( IMAP :: ATTACHMENT_TYPE_MESSAGE == $ this -> structure -> type ) { if ( $ this -> structure -> ifdescription ) { $ this -> setName ( $ this -> structure -> description ) ; } else { $ this -> setName ( $ this -> structure -> subtype ) ; } } if ( ! $ this -> name && property_exists ( $ this -> structure , 'parameters' ) ) { foreach ( $ this -> structure -> parameters as $ parameter ) { if ( strtolower ( $ parameter -> attribute ) == "name" ) { $ this -> setName ( $ parameter -> value ) ; $ this -> disposition = property_exists ( $ this -> structure , 'disposition' ) ? $ this -> structure -> disposition : null ; break ; } } } }
Fetch the given attachment

@throws Exceptions\ConnectionFailedException
Fetch the given attachment