在违反sla
的情况下以春季启动方式发送的电子邮件。例如:等待10分钟后便触发了电子邮件,但票证状态未按解决方案更改。
@RequestMapping(value="/sendMail", method = RequestMethod.POST)
public String sendmail(Simplemail simplemail, ModelMap model, @RequestParam("assignee") String name, @RequestParam("description") String description, @RequestParam("vmsid") String id) throws Exception {
MimeMessage message = sender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(message);
VelocityEngine ve = new VelocityEngine();
ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
ve.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
ve.init();
Template t = ve.getTemplate( "templates/sample.vm" );
VelocityContext context = new VelocityContext();
context.put("description", description);
context.put("id", id);
context.put("assignee", name);
StringWriter writer = new StringWriter();
t.merge( context, writer );
helper.setTo(name);
helper.setText(writer.toString());
helper.setSubject("Mail from VMS Team");
sender.send(message);
return "Mail sent successfully";
}