$participants List of user entities. */ public function notify_participants( \WebCalendar\Core\Domain\Entity\Event $event, array $participants ): void { $container = Container::get_instance(); /** @var EmailQueue */ $queue = $container->get( 'email_queue' ); /** @var \WebCalendar\WP\Bridge\WpEmailTemplate */ $template = $container->get( 'email_template' ); foreach ( $participants as $user ) { $subject = $template->get_invitation_subject( $event ); $body = $template->get_invitation_body( $event, $user ); $queue->enqueue( $user->email(), $subject, $body ); } } }