protected function onSuccess() { /** @var Emails $mailLocal */ $mailLocal = $this->em->getRepository('BuddySystemMembersBundle:Emails')->findOneBy(array("key" => "welcome_local", "section" => $this->section)); $mailLocal = $this->replace_keys($mailLocal, $this->user); $message = \Swift_Message::newInstance()->setSubject($mailLocal->getSubject())->setFrom($this->section->getEmail())->setTo($this->user->getEmail())->setBody($mailLocal->getBody(), 'text/html'); $this->mailer->send($message); if ($this->section->isMailing()) { $buddycoordinators = $this->em->getRepository('BuddySystemUserBundle:User')->findBCBysection($this->section); /** @var User $buddycoordinator */ foreach ($buddycoordinators as $buddycoordinator) { $message = \Swift_Message::newInstance()->setSubject($this->translator->trans('email.mailing.subject', array("%type%" => "mentor")))->setFrom($this->section->getEmail())->setTo($buddycoordinator->getEmail())->setBody($this->translator->trans('email.mailing.body', array("%buddy_url%" => "http://" . $this->section->getSubdomain() . ".buddysystem.eu", "%type%" => "mentor")), 'text/html'); $this->mailer->send($message); } } }
/** * Send error message to a developper * * @param $body */ public function sendError($body) { $mail = \Swift_Message::newInstance(); $mail->setFrom($this->section->getEmail())->setTo("*****@*****.**")->setSubject("[BuddySystem] Error dans le site")->setBody($body)->setContentType('text/html'); $this->mailer->send($mail); }