This has to be in the DIContainer since this is a dependency. You cant unittest this without a running mailserver right? create a simple factory that you inject into this controller