private function constructAttachment ($attachment, $boundary)
    {

        // Set variables

        $output	= NULL;

        // Add the boundary

        $output	.= '--' . $boundary . $this->_nl;

        // Add the attachment to the message

        $output	.= 'Content-Type: ' . $attachment['type'];

        if ($attachment['name'])
        {
            $output	.= '; name="' . $attachment['name'] . '"';
        }

        $output	.= $this->_nl;
        $output	.= 'Content-Transfer-Encoding: base64' . $this->_nl;

        // Add attachment as plain text if its the body, otherwise add as a file attachment

        if ($attachment['type'] == 'text/plain')
        {
            $output	.= $this->_nl;
        }
        else
        {
            $output	.= 'Content-Disposition: attachment; filename="' . $attachment['name'] . '"' . str_repeat ($this->_nl, 2);
        }

        $output	.= chunk_split (base64_encode ($attachment['data']), 70) . $this->_nl;

        // Return attachment part

        return $output;

    }