/** * Sends mail * * @param UserRegistrationInterface $registrationRecord * @param string $subject * @param string $template */ protected function sendMail(UserRegistrationInterface $registrationRecord, $subject, $template) { $user = $registrationRecord->getUser(); $message = $this->mailService->compose(['to' => $user->getEmail()], $template, ['user' => $user, 'registrationRecord' => $registrationRecord]); $fromEmail = $this->options->getEmailFromAddress(); if ($fromEmail) { $message->setFrom($fromEmail); } $message->setSubject($subject); return $this->mailService->send($message); }
/** * @param MessageInterface $message Message */ public function send(MessageInterface $message) { $template = sprintf('%s/%s.phtml', $this->getTemplatePath(), $message->getName()); $message = $this->mtMail->compose($message->getHeaders(), $template, $message->getVariables()); $this->mtMail->send($message); }