|
| |
"Using Notification Servers in J2EE Applications"
Vol. 7, Issue 8, p. 18
Listing 1
// Set your mail server properties here
Properties props=new Properties();
props.put("mail.host","mailserver.somewhere.com");
// Get a JavaMail session using the mail server
Session session =
Session.getDefaultInstance(props, null);
// Create the message
Message message = new MimeMessage(session);
// Fill the message
message.setSubject("Claim Assigned");
message.setFrom(
new InternetAddress("from@someone.com"));
message.addRecipient(Message.RecipientType.TO,
new InternetAddress("jdoe@someone.com"));
String content = "<H1> Please inspect the car and
submit incident report 024199 <H1>";
message.setContent( content,"text/html");
// Send the message
Transport.send(msg);
Listing 2
<event>
<recipient domain="cysive.com">jdoe</recipient>
<message>Claim Assigned to you</message>
<reference name="RedDot Insurance Inc."/>
<description>Claim Assigned</description>
<detail>
<name>todayDate</name>
<value>05/24/2002</value>
</detail>
<detail>
<name>Reason</name>
<value>Please determine repair costs</value>
</detail>
<detail>
<name>Claim #</name>
<value>024199</value>
</detail>
</event>
Listing 3
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="text" version="1.0"
encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:for-each select="event">
<xsl:value-of select="message"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
|
|
All Rights Reserved
Copyright © 2004 SYS-CON Media, Inc.
E-mail: info@sys-con.com
Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.
|