Hey Everyone,

As I wrote in an earlier post about JSTL tag libraries and how nice it was to learn and start using them, I've also began using another custom JSP tag library that is provided as part of the Apache Jakarta Project. If you aren't familiar with it and you are a Java Developer, I would highly recommend getting used to it. Lots of open source projects that are very useful and "usually" easy to setup and use within your applications. One example from there is the Jakarta Mailer Tag library. It's a very easy to implement tag library that you can use to send emails from within your application in a few simple steps. All documentation is located here if you would like to read more about the tags.

Here are the 3 main steps to setting up the Jakarta Mailer Tag Library on a JSP page to simply send an email:

  • Add the following Tag Library line to the top of your JSP:
CODE:
  1. <%@ taglib uri="http://jakarta.apache.org/taglibs/mailer-1.1" prefix="mt" %>

  • Add the following information to your web.xml file so your application can use the Tag Library:
XML:
  1. <taglib>
  2.   <taglib-uri>http://jakarta.apache.org/taglibs/mailer-1.1</taglib-uri>
  3.   <taglib-location>/WEB-INF/mailer.tld</taglib-location>
  4. </taglib>

  • And last but not least, use the tags in your JSP content like so to send a simple email:
XML:
  1. <mt:mail to="foo@home.net" from="bar@home.net"subject="My Test Email">
  2.      <mt:message>Your email message here!</mt:message>
  3.      <mt:send/>
  4. </mt:mail>

And that is it! 3 simple steps... If you would like more documentation visit the documentation link for more on this and all the options for sending email using the Jakarta Mailer Tag Library! I hope this information helps, I know for me it used to be a lot more difficult to send emails within our applications before I was introduced to this Custom Tag Library from Jakarta. Best of luck.

Cheers,

Adrian