Form/Handler.php
private function sendMail(FormInterface $form, MailConfigurationInterface $configuration)
    {
        // TODO FIXME this is currently the only way to get the medias to the email view.
        $additionalData = [];
        $formData = $form->getData();
        if ($formData instanceof Dynamic) {
            $additionalData = [
                'formEntity' => $formData->getForm()->serializeForLocale($configuration->getLocale(), $formData),
            ];
        }

        $body = $this->templating->render(
            $configuration->getTemplate(),
            array_merge(
                $configuration->getTemplateAttributes(),
                $additionalData
            )
        );

        $this->mailHelper->sendMail(
            $configuration->getSubject(),
            $body,
            $configuration->getTo(),
            $configuration->getFrom(),
            true,
            $configuration->getReplyTo(),
            $configuration->getAddAttachments() ? $this->attachments : [],
            $configuration->getCc(),
            $configuration->getBcc()
        );
    }
private function sendMail(FormInterface $form, MailConfigurationInterface $configuration)
    {
        // TODO FIXME this is currently the only way to get the medias to the email view.
        $additionalData = [];
        $formData = $form->getData();
        if ($formData instanceof Dynamic) {
            $additionalData = [
                'formEntity' => $formData->getForm()->serializeForLocale($configuration->getLocale(), $formData),
            ];
        }

        $body = $this->templating->render(
            $configuration->getTemplate(),
            array_merge(
                $configuration->getTemplateAttributes(),
                $additionalData
            )
        );

        $this->mailHelper->sendMail(
            $configuration->getSubject(),
            $body,
            $configuration->getTo(),
            $configuration->getFrom(),
            true,
            $configuration->getReplyTo(),
            $configuration->getAddAttachments() ? $this->attachments : [],
            $configuration->getCc(),
            $configuration->getBcc()
        );
    }
Send mail.

@param FormInterface $form
@param MailConfigurationInterface $configuration