Bolt\Controller\Backend\Users::notifyUserSetupEmail PHP Method

notifyUserSetupEmail() private method

Send a welcome email to test mail settings.
private notifyUserSetupEmail ( Request $request, string $displayName, string $email )
$request Symfony\Component\HttpFoundation\Request
$displayName string
$email string
    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']);
        }
    }