|
4. Mail Notification
Overview
To implement the
Mail Notification, you must:
- implement the Notification
class
- implement a class
to send a mail
4.1. Implement the Notification class
The following code handles
implementing the Notification API.
PluginMailNotification
| Class Name |
oracle.reports.plugin.notification.mail.PluginMailNotification |
| Description |
This
is the implementation of the Notification interface |
| implements |
oracle.reports.server.Notification |
1. init(properties)
method
This method receives
all the parameter of the notification in the Properties object.
All the properties are read here from the Reports Server configuration
file, and load them in variable.
This methods also create
an instance of the PluginMailService.
2. notify(job) method
This method receives
the Job as parameter. Using the Job information, status and parameter,
the notify method prepares a mail message using the helper class
PluginMailService.
4.2. Implement the Send Mail class
The following code handles
implementing the PluginMailService class that send mail using the
JavaMail API. JavaMail is part of the J2EE container, you can find
more information here.
This class is an helper class to send mail, you can reuse it in
any context.
PluginMailService
| Class Name |
oracle.reports.plugin.notification.mail.PluginMailService |
| Description |
This
is the class implement the logic to send a mail |
1. constructor(protocol,
serverName) method
The constructor create
a javamail session on the SMTP server.
2. send(content,
from, toList, ccList, bccList, replyTo, subject) method
This method prepares
a message with the differents values received as parameters and
send it using Java Mail tools.
|