from = $mail->getSender(); $ingresEmail->subject = $mail->getSubject(); $ingresEmail->plain_message = $mail->getBodyText(); $ingresEmail->html_message = $mail->getBodyHtml(); $ingresEmail->date = $mail->getDate(); // parse documents as UploadedFile foreach ($mail->getAttachments() as $attachment) { $ingresEmail->documents[] = TempFile::UploadedFileFromRaw($attachment->getContent(), $attachment->getFilename(), $attachment->getEncoding()); } return $ingresEmail; } }