public class CommonsEmail extends Object implements Jooby.Module
Small but helpful module that provides access to Email instances via Guice and
Config.
mail.hostName = smtp.googlemail.com mail.ssl.onConnect = true mail.username = username mail.password = password mail.from = user@gmail.com mail.subject = TestMail
{
use(new CommonsEmail());
get("/send", req -> {
req.require(SimpleEmail.class)
.setMsg("you got an email!")
.setTo("foo@bar.com")
.send();
});
}
That's all it does! Every time you require an email, it creates one and setup properties from
mail.*.
| Constructor and Description |
|---|
CommonsEmail()
Creates a
CommonsEmail. |
CommonsEmail(String name)
Creates a
CommonsEmail. |
| Modifier and Type | Method and Description |
|---|---|
com.typesafe.config.Config |
config() |
void |
configure(Env env,
com.typesafe.config.Config config,
com.google.inject.Binder binder) |
CommonsEmail |
named()
Call this method if you need two or more mail configuration.
|
public CommonsEmail(String name)
CommonsEmail.name - Name of the property who has the mail information. Default is: mail.*.public CommonsEmail()
CommonsEmail.public CommonsEmail named()
public void configure(Env env, com.typesafe.config.Config config, com.google.inject.Binder binder)
configure in interface Jooby.Modulepublic com.typesafe.config.Config config()
config in interface Jooby.ModuleCopyright © 2015. All rights reserved.