NotificationHandler.pm

Contents


1. Description
2. Usage
3. Method Index

1. Description

The perl module NotificationHandler.pm is a wrapper around the UNIX mailfile command for easy creation of email messages.

2. Usage

The following examples show the basic usage of the NotificationHandler module.

Creating a new document in a collection
use NotificationHandler;   # NotificationHandler has to be in @INC
  #
$collection = new NotificationHandler;   # creating a new instance
$indexer -> setAddress('Andreas.Wagner@cern.ch');   # setting the To address(es)
$indexer -> setCcAddress('it-us-info@lsitbox.cern.ch');   # setting the Cc address(es)
$indexer -> setSubject('This is a Notification Message');   # setting the Subject line
$indexer -> setMessage("Hello, \n this is the message text\n");   # setting message body
$indexer -> sendNotification();   # sends the mail message.


3. Method Index

  new()
  getAddress()
  setAddress()
  getCcAddress()
  setCcAddress()
  getMessage()
  setMessage()
  getFromText()
  setFromText()
  getSubject()
  setSubject()
  sendNotification_old()
  sendNotification()
  _checkEmailSyntax()
getSubject setSubject sendNotification_old sendNotification _checkEmailSyntax

new

Creates a new instance of NotificationHandler.

Example: $message = new NotificationHandler;


setAddress

Sets the To: adress(es) for the message. One or more addresses can be specified using a blank or comma separated string of addresses.

Example: $message->setAddress('Andreas.Wagner@cern.ch, Miguel.Marquina@cern.ch');


getAddress

Returns the To: adresses of the message.

Example: $to = $message->getAddress();


setCcAddress

Sets the CC: adresses for the message. .One or more addresses can be specified using a blank or comma separated string of addresses.

Example: $message->setCcAddress('it-us-info@listbox.cern.ch');


getCcAddress

Returns the Cc: adresses of the message.

Example: $cc = $message->getCcAddress();


setMessage

Sets the message body, if the first lines are containing Mail-tags these are respected since the message is sent using mailfile with the -wh flag.

Example: $message->setMessage("Hello, \n this is the message text\n");


getMessage

.

Example: $meassge_text = $message->getMessage();


setFromText

This method allows to specify the From: field which will appear in the recipients mail-client.

Example: $message->setFromText('IT Reports Service


getFromText

Returns the presetn setting of the From: field.

Example: $from_text = $message->getFromText;


setSubject

Sets the Subject: field.

Example: $message->setSubject('This is a Notification Message');


getSubject

Returns the present value of the Subject: field.

Example: $subject = $message->getSubject();


sendNotification

Sends the message.

Example: $message->sendNotification() ;


sendNotification_old

Sends the message using the UNIX sendmail command. Mail tags at the begginning of the message text are not recognised as for.sendNotification.

Example: $message->sendNotification_old() ;


_checkEmailSyntax

Internal method to verify the sysntax of email addresses.

Example: N.A.