Feb 26 2009

Sending email with Spring and Velocity

Published by Gilles at 9:20 pm under J2EE, Java, Programming, Spring

Usage: the action class

In my case, I use my email service in a struts action class:

JAVA:
  1. public class MyAction
  2. extends ActionSupport
  3. implements Preparable ,ValidationAware{
  4. // injected
  5. private EmailService emailService;
  6.  
  7. private SimpleMailMessage validationMessage;public String notifyValidation(){
  8. List<string> recipients = new ArrayList<string>();
  9. recipients.add(myObject.getEmail());
  10. Map<string,object> params = new HashMap<string,>();
  11. params.put("user", user);
  12. emailService.sendEmail(validationMessage, recipients, params);
  13. }</string,></string,object></string></string>
  14.  
  15. }

Pages: 1 2 3 4 5 6 7

One Response to “Sending email with Spring and Velocity”

  1. asdfon 30 May 2010 at 5:46 pm

    reading this article is like pain in the ass. please next time split such article into 20 pages, 7 is not enought

Trackback URI | Comments RSS

Leave a Reply