NAME

ADMMailHandler.pm


USAGE

use ADMMailHandler;


DESCRIPTION

ADMLogger is an object-oriented extendable framework for log analysis tools. Many system administrators have a handful of tools that they like to run on their logs daily/weekly/at rotation, etc. ADMLogger attempts to bring them all together by providing a set of common tools for all perl scripts to to maintain a consistency across all programs. It also allows the admin to only run a single program, and for them to focus on the coding of the core of what they need to do - allowing ADMLogger to provide all I/O support, etc.

Typical lifecycle of an ADMMailHandler object: Contruction Subject Building Sending (Destruction)


BUGS

None known.


AUTHORS

Aaron D. Marasco (Aaron@Marascos.net)


LIST OF PUBLIC METHODS

 new
 subject
 append
 checkflag
 clearflag
 isHTML
 setHTML
 isSendable
 sendit


METHODS

new
Constructor

Usage:

 new($to, $html, $subject);

Parameters:

 $to      - e-mail address message will be sent to
 $html    - flag to send HTML MIME Type or not
 $subject - subject of email (optional)
            can be changed - see subject()

Returns:

 Reference to a ready ADMMailHandler.

subject
Changes the subject of the outgoing message

Usage:

 subject($subject);

Parameters:

 $subject - subject of email

Returns:

 string - Empty if success, else error message.

append
Usage:
 append($string);

Parameters:

 $string            - a single string to add

Returns:

 string - Empty if success, else error message (none defined).

checkflag
Checks if message has been appended to, either ever or since last clearflag call

Usage:

 checkflag();

Parameters:

 none

Returns:

 1 if data has changed, 0 if not.

clearflag
Clears 'message modified' flag. Useful to refrain from sending useless messages.

Usage:

 clearflag();

Parameters:

 none

Returns:

 1 always.

isHTML
Checks if message will be HTML formatted

Usage:

 isHTML();

Parameters:

 none

Returns:

 1 if HTML enabled, 0 if not.

setHTML
Can change default HTML options

Usage:

 setHTML($flag);

Parameters:

 $flag - 1 if HTML enabled, 0 if not.

Returns:

 0 if $flag is invalid, otherwise 1.

isSendable
Checks if message can be sent in current state

Usage:

 isSendable();

Parameters:

 none

Returns:

 1 if sendit should succeed, 0 if not.

sendit
Usage:
 sendit($mailer);

Parameters:

 $mailer - mail executable to use (optional)
           defaults to "/usr/sbin/sendmail -t"

Returns:

 string - Empty if success, else error message.