Controller/ContactFormController.php
protected function sendEmails(ContactInquiry $inquiry)
    {
        $recipients = $this->container->getParameter('c33s_contact_form.email.recipients');
        if ($this->container->getParameter('c33s_contact_form.email.send_copy_to_user') && $inquiry->hasSenderEmail()) {
            $recipients[] = $inquiry->getSenderEmail();
        }

        if (empty($recipients)) {
            return;
        }

        $translator = $this->get('translator');

        $subject = $this->container->getParameter('c33s_contact_form.email.subject');

        $message = \Swift_Message::newInstance()
            ->setSubject($translator->trans($subject, array(), 'C33sContactForm'))
            ->setFrom($this->container->getParameter('c33s_contact_form.email.sender_email'))
            ->setTo($recipients)
            ->setBody(
                $this->renderView(
                    'C33sContactFormBundle:ContactForm:email.txt.twig',
                    array('inquiry' => $inquiry)
                )
            )
        ;

        $this->get('mailer')->send($message);
    }
protected function sendEmails(ContactInquiry $inquiry)
    {
        $recipients = $this->container->getParameter('c33s_contact_form.email.recipients');
        if ($this->container->getParameter('c33s_contact_form.email.send_copy_to_user') && $inquiry->hasSenderEmail()) {
            $recipients[] = $inquiry->getSenderEmail();
        }

        if (empty($recipients)) {
            return;
        }

        $translator = $this->get('translator');

        $subject = $this->container->getParameter('c33s_contact_form.email.subject');

        $message = \Swift_Message::newInstance()
            ->setSubject($translator->trans($subject, array(), 'C33sContactForm'))
            ->setFrom($this->container->getParameter('c33s_contact_form.email.sender_email'))
            ->setTo($recipients)
            ->setBody(
                $this->renderView(
                    'C33sContactFormBundle:ContactForm:email.txt.twig',
                    array('inquiry' => $inquiry)
                )
            )
        ;

        $this->get('mailer')->send($message);
    }
protected function sendEmails ( ContactInquiry $ inquiry ) { $ recipients = $ this -> container -> getParameter ( 'c33s_contact_form.email.recipients' ) ; if ( $ this -> container -> getParameter ( 'c33s_contact_form.email.send_copy_to_user' ) && $ inquiry -> hasSenderEmail ( ) ) { $ recipients [ ] = $ inquiry -> getSenderEmail ( ) ; } if ( empty ( $ recipients ) ) { return ; } $ translator = $ this -> get ( 'translator' ) ; $ subject = $ this -> container -> getParameter ( 'c33s_contact_form.email.subject' ) ; $ message = \ Swift_Message :: newInstance ( ) -> setSubject ( $ translator -> trans ( $ subject , array ( ) , 'C33sContactForm' ) ) -> setFrom ( $ this -> container -> getParameter ( 'c33s_contact_form.email.sender_email' ) ) -> setTo ( $ recipients ) -> setBody ( $ this -> renderView ( 'C33sContactFormBundle:ContactForm:email.txt.twig' , array ( 'inquiry' => $ inquiry ) ) ) ; $ this -> get ( 'mailer' ) -> send ( $ message ) ; }
Send all notification emails for the given inquiry object.

@param ContactInquiry $inquiry
Send all notification emails for the given inquiry object .