translator->trans('mautic.webhook.stopped'); $reason = $this->translator->trans($reason); $htmlUrl = ''.$webhook->getName().''; $details = $this->translator->trans( 'mautic.webhook.stopped.details', [ '%reason%' => $reason, '%webhook%' => $htmlUrl, ] ); /** @var User $owner */ $owner = $toUser = $this->entityManager->getReference(User::class, $webhook->getCreatedBy()); $ccToUser = null; if (null !== $webhook->getModifiedBy() && $webhook->getCreatedBy() !== $webhook->getModifiedBy()) { $modifiedBy = $this->entityManager->getReference(User::class, $webhook->getModifiedBy()); $toUser = $modifiedBy; // Send notification to modifier $ccToUser = $owner; // And cc e-mail to owner } // Send notification $this->notificationModel->addNotification( $details, 'error', false, $subject, null, null, $toUser ); // Send e-mail $mailer = $this->mailer; $sendToAuthor = $this->coreParametersHelper->get('webhook_send_notification_to_author', 1); if ($sendToAuthor) { $mailer->setTo($toUser->getEmail()); if ($ccToUser) { $mailer->setCc([$ccToUser->getEmail() => null]); } } else { $emailAddresses = array_map('trim', explode(',', $this->coreParametersHelper->get('webhook_notification_email_addresses'))); $mailer->setTo($emailAddresses); } $mailer->setSubject($subject); $mailer->setBody($details); $mailer->send(true); } }