You could use the mailer taglib from Jakarta Taglibs:
Documentation + Sample Code:
/* It is impossible to defeat an ignorant man in argument. */
Here is how
String from, to, etc...;
java.util.Properties propz = System.getProperties();
Session sess = Session.getDefaultInstance(propz,null);
MimeMessage msg = new MimeMessage(sess);
MimeMultipart mp = new MimeMultipart("related");
MimeBodyPart bp = new MimeBodyPart();
bp = new MimeBodyPart();
String staturl = ...;
bp.setDataHandler(new DataHandler(new URLDataSource(new java.net.URL(staturl))));
bp.addHeaderLine("Content-Type: text/html; charset=\"iso-8859-1\"");
Thank you for the reply.
I have had a problem few days back when tryign to do that.
At the line, MimeMessage msg = new MimeMessage(sess), it threw an exception saying it cannot find javax.activation.DataSource.
I did put activation.jar in the class and took a print out if the system classpath just before this statement also.
After one whole days struggle I figured out that it is not sufficient if I add it to classpath, I need to put it in jre/lib/ext and then it worked.
I am posting this so that anybody else who might be facing the same problem could use the effort.
the jar located at /usr/local/jboss-3.0.3/server/default/lib/activation.jar
should be just fine.
In which ..../lib/ext did you put the jar in??
No, the server/default/lib did not work.
I had to put it in $JAVA_HOME/jre/lib/ext for it to work.