Mango Documentation

Mail

The provided MailService is a thin layer above Springs mail support using Apache Velocity as template engine. To make the mail service available, include MangoMailApplicationContext.xml in your application context configuration.

Velocity mail template example

Hello ${name},

welcome to ${link}, your username is ${username}

example mail service usage

@Autowired
MailService mailService;

Map<String, Object> model = new HashMap<String, Object>();
model.put("name", "Steve");
model.put("link", "http://www.example.org");
model.put("username", "steve23");

mailService.sendMail("[email protected]", "classpath://mailtemplate.vm", model);

Configuration

The mail service is configured via Mangos configuration file, using the following parameters

parameter name description default
mail.sender.host smtp host localhost
mail.sender.port smtp port 25
mail.sender.username smtp username <none>
mail.sender.username smtp password <none>
mail.sender.from defaut from for mails [email protected]