public function sendMail(Form $form, Result $result)
    {
        $message = \Swift_Message::newInstance()
            ->setSubject($form->getMailSubject())
            ->setTo(array($form->getMailRecipientEmail() => $form->getMailRecipientName()))
            ->setBody($this->container->get('templating')->render('NetvliesFormBundle:Mail:result.html.twig', array(
                'content' => $form->getMailBody(),
                'entries' => $result->getEntries(),
            )), 'text/html');

        if ($form->getMailSenderName() != null && $form->getMailSenderEmail() != null) {
            $message->setFrom(array($form->getMailSenderEmail() => $form->getMailSenderName()));
        }

        $this->container->get('mailer')->send($message);

        $transport = $this->container->get('mailer')->getTransport();
        if (!$transport instanceof \Swift_Transport_SpoolTransport) {
            return;
        }

        $spool = $transport->getSpool();
        if (!$spool instanceof \Swift_MemorySpool) {
            return;
        }

        $spool->flushQueue($this->container->get('swiftmailer.transport.real'));
    }