Using PHP-IMAP to retrieve emails from host

I am using this library with Symfony 4 to retrieve emails from the server . But I am getting this error message 

An exception has been thrown during the rendering of a template ("Service "secit.imap" not found: even though it exists in the app's container, the container inside "App\Controller\IndexController" is a smaller service locator that only knows about the "doctrine", "form.factory", "http_kernel", "parameter_bag", "request_stack", "router", "security.authorization_checker", "security.csrf.token_manager", "security.token_storage", "serializer", "session" and "twig" services. Unless you need extra laziness, try using dependency injection instead. Otherwise, you need to declare it using "IndexController::getSubscribedServices()".").

the code that I am using to connect is 

$exampleConnection = $imap->get('example_connection');

       $isConnectable = $this->get('secit.imap')->testConnection('example_connection');

But apparently it does not find the service 


If you’re not getting the desired answer here, you might want to try asking the developers directly: .