I\'m looking at the scaly code example from play-mailer: https://github.com/playframework/play-mailer
It goes basically like this:
class MyComponent @
this is not a scala Issues, but a DI one. You should read some guice documentation.
In Play 2.4.x, you need to use dependency injection (https://www.playframework.com/documentation/2.4.x/ScalaDependencyInjection) to achieve your goal.
Your AnObject should be:
@Singleton class AnObject @Inject()(mailer:MyComponent){
def sendEmail = mailer.doStuff
}