title: Symfony Fosuserbundle resend email
body: <p>I am trying to make a link that resends a confirmation token to a user after registering in Symfony3.</p>
  
  <p>However, I get a deprecation message as follows:</p>
  
  <blockquote>
    <p>User Deprecated: The "fos_user.mailer" service is private, getting it
    from the container is deprecated since Symfony 3.2 and will fail in
    4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.</p>
  </blockquote>
  
  <p>Here is my controller:</p>
  
  <pre><code>public function resendActivationEmail($token, UserManagerInterface $userManager)
  {
      $user = $userManager-&gt;findUserByConfirmationToken($token);
      if (is_null($user)) {return $this-&gt;redirectToRoute('fos_user_registration_register');}
      $mailer = $this-&gt;get('fos_user.mailer');
      $mailer-&gt;sendConfirmationEmailMessage($user);
      return $this-&gt;redirectToRoute('fos_user_registration_check_email');
  }
  </code></pre>
  
  <p>My services.yml:</p>
  
  <pre><code>services:
      # default configuration for services in *this* file
      _defaults:
          autowire: truesubscribers, etc.
          autoconfigure: true
          public: false
  </code></pre>
  
  <p>I looked into the docs, it says that in Symfony3.4, services are private by default. I am using autowiring in my app, so how I get the <code>fos_user.mailer</code> without any deprecation warnings?</p>
  
  <p>I tried setting Fosuserbundle services to public, doesnt help:</p>
  
  <p><code>services.yml</code>:</p>
  
  <pre><code>    ....
      FOS\UserBundle:
              public: true
  </code></pre>
  
  <p>Any help appreciated!</p>