/** * @param Mail $mail * @return array */ private function getImages(Mail $mail) { $out = array(); foreach ($mail->getImages() as $image) { $out[] = array('type' => $image->getMimetype(), 'name' => $image->getName(), 'content' => base64_encode(file_get_contents($image->getPath()))); } return $out; }