Controller/MailController.php
public function viewLog(TranslatorInterface $translator, $id)
    {
        // Find Template
        $log = $this
            ->getDoctrine()
            ->getRepository($this->getParameter('pd_mailer.mail_log_class'))
            ->findOneBy(['id' => $id]);
        if (!$log) throw $this->createNotFoundException();

        $data = [
            $translator->trans('mail_templateid') => $log->getTemplateId(),
            $translator->trans('mail_mid') => $log->getMailId(),
            $translator->trans('mail_to') => implode(PHP_EOL, $this->implodeKeyValue($log->getTo(), ' -> ')),
            $translator->trans('mail_from') => implode(PHP_EOL, $this->implodeKeyValue($log->getFrom(), ' -> ')),
            $translator->trans('mail_subject') => $log->getSubject(),
            $translator->trans('mail_language') => $log->getLanguage(),
            $translator->trans('mail_content_type') => $log->getContentType(),
            $translator->trans('date') => date('Y-m-d H:i:s', $log->getDate()->getTimestamp()),
            $translator->trans('mail_reply_to') => $log->getReplyTo(),
            $translator->trans('mail_header') => '<code>' . str_replace(PHP_EOL, '<br/>', htmlspecialchars($log->getHeader())) . '</code>',
            $translator->trans('mail_status') => $log->getStatus() . ' = ' . $this->swiftEventFilter($translator, $log->getStatus()),
            $translator->trans('mail_exception') => str_replace(PHP_EOL, '<br/>', htmlspecialchars($log->getException())),
        ];

        // JSON Response
        return $this->json($data);
    }
public function viewLog(TranslatorInterface $translator, $id)
    {
        // Find Template
        $log = $this
            ->getDoctrine()
            ->getRepository($this->getParameter('pd_mailer.mail_log_class'))
            ->findOneBy(['id' => $id]);
        if (!$log) throw $this->createNotFoundException();

        $data = [
            $translator->trans('mail_templateid') => $log->getTemplateId(),
            $translator->trans('mail_mid') => $log->getMailId(),
            $translator->trans('mail_to') => implode(PHP_EOL, $this->implodeKeyValue($log->getTo(), ' -> ')),
            $translator->trans('mail_from') => implode(PHP_EOL, $this->implodeKeyValue($log->getFrom(), ' -> ')),
            $translator->trans('mail_subject') => $log->getSubject(),
            $translator->trans('mail_language') => $log->getLanguage(),
            $translator->trans('mail_content_type') => $log->getContentType(),
            $translator->trans('date') => date('Y-m-d H:i:s', $log->getDate()->getTimestamp()),
            $translator->trans('mail_reply_to') => $log->getReplyTo(),
            $translator->trans('mail_header') => '<code>' . str_replace(PHP_EOL, '<br/>', htmlspecialchars($log->getHeader())) . '</code>',
            $translator->trans('mail_status') => $log->getStatus() . ' = ' . $this->swiftEventFilter($translator, $log->getStatus()),
            $translator->trans('mail_exception') => str_replace(PHP_EOL, '<br/>', htmlspecialchars($log->getException())),
        ];

        // JSON Response
        return $this->json($data);
    }
public function viewLog ( TranslatorInterface $ translator , $ id ) { // Find Template $ log = $ this -> getDoctrine ( ) -> getRepository ( $ this -> getParameter ( 'pd_mailer.mail_log_class' ) ) -> findOneBy ( [ 'id' => $ id ] ) ; if ( ! $ log ) throw $ this -> createNotFoundException ( ) ; $ data = [ $ translator -> trans ( 'mail_templateid' ) => $ log -> getTemplateId ( ) , $ translator -> trans ( 'mail_mid' ) => $ log -> getMailId ( ) , $ translator -> trans ( 'mail_to' ) => implode ( PHP_EOL , $ this -> implodeKeyValue ( $ log -> getTo ( ) , ' -> ' ) ) , $ translator -> trans ( 'mail_from' ) => implode ( PHP_EOL , $ this -> implodeKeyValue ( $ log -> getFrom ( ) , ' -> ' ) ) , $ translator -> trans ( 'mail_subject' ) => $ log -> getSubject ( ) , $ translator -> trans ( 'mail_language' ) => $ log -> getLanguage ( ) , $ translator -> trans ( 'mail_content_type' ) => $ log -> getContentType ( ) , $ translator -> trans ( 'date' ) => date ( 'Y-m-d H:i:s' , $ log -> getDate ( ) -> getTimestamp ( ) ) , $ translator -> trans ( 'mail_reply_to' ) => $ log -> getReplyTo ( ) , $ translator -> trans ( 'mail_header' ) => '<code>' . str_replace ( PHP_EOL , '<br/>' , htmlspecialchars ( $ log -> getHeader ( ) ) ) . '</code>' , $ translator -> trans ( 'mail_status' ) => $ log -> getStatus ( ) . ' = ' . $ this -> swiftEventFilter ( $ translator , $ log -> getStatus ( ) ) , $ translator -> trans ( 'mail_exception' ) => str_replace ( PHP_EOL , '<br/>' , htmlspecialchars ( $ log -> getException ( ) ) ) , ] ; // JSON Response return $ this -> json ( $ data ) ; }
View Log.

@param MailLog $log

@IsGranted("ROLE_MAIL_VIEWLOG")

@return \Symfony\Component\HttpFoundation\Response
View Log .