private function buildWebsiteMailConfigurationByDynamic(Dynamic $dynamic)
    {
        $form = $dynamic->getForm();
        $locale = $dynamic->getLocale();
        $translation = $form->getTranslation($locale);

        if ($translation->getDeactivateCustomerMails()) {
            return null;
        }

        $websiteMailConfiguration = $this->createMailConfiguration($locale);

        $websiteMailConfiguration->setSubject($translation->getSubject());
        $websiteMailConfiguration->setFrom(
            $this->getEmail($translation->getFromEmail(), $translation->getFromName())
        );
        $websiteMailConfiguration->setTo($this->getEmailFromDynamic($dynamic));

        // Set attachment configuration.
        $websiteMailConfiguration->setAddAttachments($translation->getSendAttachments());

        // Set template.
        $websiteMailConfiguration->setTemplate($this->mailWebsiteTemplate);
        $websiteMailConfiguration->setTemplateAttributes($this->getTemplateAttributesFromDynamic($dynamic));

        return $websiteMailConfiguration;
    }
private function buildWebsiteMailConfigurationByDynamic(Dynamic $dynamic)
    {
        $form = $dynamic->getForm();
        $locale = $dynamic->getLocale();
        $translation = $form->getTranslation($locale);

        if ($translation->getDeactivateCustomerMails()) {
            return null;
        }

        $websiteMailConfiguration = $this->createMailConfiguration($locale);

        $websiteMailConfiguration->setSubject($translation->getSubject());
        $websiteMailConfiguration->setFrom(
            $this->getEmail($translation->getFromEmail(), $translation->getFromName())
        );
        $websiteMailConfiguration->setTo($this->getEmailFromDynamic($dynamic));

        // Set attachment configuration.
        $websiteMailConfiguration->setAddAttachments($translation->getSendAttachments());

        // Set template.
        $websiteMailConfiguration->setTemplate($this->mailWebsiteTemplate);
        $websiteMailConfiguration->setTemplateAttributes($this->getTemplateAttributesFromDynamic($dynamic));

        return $websiteMailConfiguration;
    }
private function buildWebsiteMailConfigurationByDynamic ( Dynamic $ dynamic ) { $ form = $ dynamic -> getForm ( ) ; $ locale = $ dynamic -> getLocale ( ) ; $ translation = $ form -> getTranslation ( $ locale ) ; if ( $ translation -> getDeactivateCustomerMails ( ) ) { return null ; } $ websiteMailConfiguration = $ this -> createMailConfiguration ( $ locale ) ; $ websiteMailConfiguration -> setSubject ( $ translation -> getSubject ( ) ) ; $ websiteMailConfiguration -> setFrom ( $ this -> getEmail ( $ translation -> getFromEmail ( ) , $ translation -> getFromName ( ) ) ) ; $ websiteMailConfiguration -> setTo ( $ this -> getEmailFromDynamic ( $ dynamic ) ) ; // Set attachment configuration. $ websiteMailConfiguration -> setAddAttachments ( $ translation -> getSendAttachments ( ) ) ; // Set template. $ websiteMailConfiguration -> setTemplate ( $ this -> mailWebsiteTemplate ) ; $ websiteMailConfiguration -> setTemplateAttributes ( $ this -> getTemplateAttributesFromDynamic ( $ dynamic ) ) ; return $ websiteMailConfiguration ; }
Build website mail configuration by form translation.

@param Dynamic $dynamic

@return MailConfiguration|null
Build website mail configuration by form translation .