private function notifyUserSetupEmail(Request $request, $displayName, $email)
{
// Create a welcome email
$mailhtml = $this->render('@bolt/email/firstuser.twig', ['sitename' => $this->getOption('general/sitename')])->getContent();
try {
// Send a welcome email
$name = $this->getOption('general/mailoptions/senderName', $this->getOption('general/sitename'));
$from = ['bolt@' . $request->getHost() => $name];
$email = $this->getOption('general/mailoptions/senderMail', $email);
$message = $this->app['mailer']->createMessage('message')->setSubject(Trans::__('general.bolt-new-site-set-up'))->setFrom($from)->setReplyTo($from)->setTo([$email => $displayName])->setBody(strip_tags($mailhtml))->addPart($mailhtml, 'text/html');
$failedRecipients = [];
$this->app['mailer']->send($message, $failedRecipients);
// Try and send immediately
$this->app['swiftmailer.spooltransport']->getSpool()->flushQueue($this->app['swiftmailer.transport']);
} catch (\Exception $e) {
// Sending message failed. What else can we do, send via snailmail?
$this->app['logger.system']->error("The 'mailoptions' need to be set in app/config/config.yml", ['event' => 'config']);
}
}