protected function prepareAttachment(\Swift_Attachment $attachment, array $options = [])
{
if (isset($options['mime'])) {
$attachment->setContentType($options['mime']);
}
if (isset($options['as'])) {
$attachment->setFilename($options['as']);
}
$eventManager = $this->getManager()->getEventsManager();
if ($eventManager) {
$result = $eventManager->fire('mailer:beforeAttachFile', $this, [$attachment]);
} else {
$result = true;
}
if ($result !== false) {
$this->getMessage()->attach($attachment);
if ($eventManager) {
$eventManager->fire('mailer:afterAttachFile', $this, [$attachment]);
}
}
return $this;
}