public function emailDetailsByTokenAction(Request $request, $token)
    {
        $email = $this->getDoctrine()->getManager()->getRepository(SentEmail::class)
            ->findOneByToken($token);

        if ($email instanceof SentEmail) {
            $recipients = implode(', ', $email->getRecipients());
            $variables = implode(', ', array_keys($email->getVariables()));

            return $this->render('AzineEmailBundle::sentEmailDetails.html.twig',
                array('email' => $email, 'recipients' => $recipients, 'variables' => $variables));
        }

        // the parameters-array is null => the email is not available in webView
        $days = $this->getParameter('azine_email_web_view_retention');
        $response = $this->render('AzineEmailBundle:Webview:mail.not.available.html.twig', array('days' => $days));
        $response->setStatusCode(404);

        return $response;
    }