Пример #1
0
 public function send($to, $templateName, array $data = [])
 {
     $template = $this->templateBuilder->get($templateName);
     $message = $this->mailAssembler->assemble($to, $template, $data);
     $this->mailTransport->send($message);
     $event = new Event('mail-send:post', $this, ['to' => $to, 'template' => $template, 'message' => $message, 'data' => $data]);
     $this->eventManager->trigger($event);
 }
Пример #2
0
 public function testGetWithBadConfig()
 {
     $renderer = $this->prophesize(RendererInterface::class);
     $config = ['from-email' => '*****@*****.**', 'from-name' => 'Support Mail.com', 'templates' => [], 'layout' => ['default' => 't4web-mail/layout/default']];
     $factory = new TemplateBuilder($config, $renderer->reveal());
     $this->setExpectedException(TemplateNotExistsException::class);
     $templateName = 'xxx';
     $factory->get($templateName);
 }