/** * Download an AuditMail file as eml. * @param $id * @throws NotFoundHttpException */ public function actionDownload($id) { $model = AuditMail::findOne($id); if (!$model) { throw new NotFoundHttpException('The requested mail does not exist.'); } Yii::$app->response->sendContentAsFile(Helper::uncompress($model->data), $model->id . '.eml'); }