public function sendNewModifiedTalentInfoMessage(Request $request, Talent $eq) { $to = $this->getParameter('admin_email'); $template = 'Emails\\talent\\new_modified_item.html.twig'; $url = $request->getSchemeAndHttpHost() . $this->generateUrl('admin_talent_moderate', array('id' => $eq->getId())); $emailHtml = $this->renderView($template, array('talent' => $eq, 'mailer_app_url_prefix' => $this->getParameter('mailer_app_url_prefix'), 'url' => $url)); $from = array($this->getParameter('mailer_fromemail') => $this->getParameter('mailer_fromname')); $message = Swift_Message::newInstance()->setSubject('New/modified talent notification.')->setFrom($from)->setTo($to)->setBody($emailHtml, 'text/html'); $this->get('mailer')->send($message); }
public function sendApprovedRejectedInfoMessage(Request $request, Talent $eq, $reason) { $template = 'Emails/admin/item_approved.html.twig'; if ($eq->getStatus() == Talent::STATUS_REJECTED) { $template = 'Emails/admin/item_rejected.html.twig'; } $userLink = $request->getSchemeAndHttpHost() . $this->generateUrl('dashboard'); $eqLink = $request->getSchemeAndHttpHost() . $this->generateUrl('catchall', array('content' => $eq->getUrlPath())); $emailHtml = $this->renderView($template, array('item' => $eq, 'mailer_app_url_prefix' => $this->getParameter('mailer_app_url_prefix'), 'reason' => $reason, 'userLink' => $userLink, 'status_approved' => Talent::STATUS_APPROVED, 'status_rejected' => Talent::STATUS_REJECTED, 'itemLink' => $eqLink)); $subject = $eq->getStatus() == Talent::STATUS_APPROVED ? "Dein Angebot wurde akzeptiert" : "Dein Angebot nicht akzeptiert wurde"; $from = array($this->getParameter('mailer_fromemail') => $this->getParameter('mailer_fromname')); $message = Swift_Message::newInstance()->setSubject($subject)->setFrom($from)->setTo($eq->getUser()->getEmail())->setBody($emailHtml, 'text/html'); $this->get('mailer')->send($message); }