/** * @param Invitation $invitation * @throws InvitationExpiredException * @throws SendException */ public function sendInvitation(Invitation $invitation) { try { $this->emailNotifier->send('Výčetkový systém <' . $this->systemEmail . '>', $invitation->email, function (ITemplate $template, Invitation $invitation, $senderName, $applicationUrl) { $template->setFile(__DIR__ . '/../../model/Notifications/templates/invitation.latte'); $template->invitation = $invitation; $template->username = $senderName; $template->applicationUrl = $applicationUrl; }, [$invitation, $invitation->getSender()->username, $this->applicationUrl]); } catch (SendException $e) { $this->onCritical(sprintf('Invitation sending failed. [%s]', $invitation->getEmail()), $e, self::class); throw $e; } }