## Class LoggerAppenderMail

Description

LoggerAppenderMail appends log events via email.

This appender does not send individual emails for each logging requests but will collect them in a buffer and send them all in a single email once the appender is closed (i.e. when the script exists). Because of this, it may not appropriate for long running scripts, in which case LoggerAppenderMailEvent might be a better choice.

This appender uses a layout.

## Configurable parameters: ##

- **to** - Email address(es) to which the log will be sent. Multiple email addresses may be specified by separating them with a comma.
- **from** - Email address which will be used in the From field.
- **subject** - Subject of the email message.

- version: $Revision: 1337820 $
- link: Appender documentation
- license: Apache License, Version 2.0

Located in /log4php/appenders/LoggerAppenderMail.php (line 43)

    LoggerConfigurable
       |
       --LoggerAppender
          |
          --LoggerAppenderMail

Variable Summary
string $body
boolean $dry
string $from
string $subject
string $to
Method Summary
void append (LoggerLoggingEvent $event)
void close ()
void getFrom ()
void getSubject ()
void getTo ()
void setDry ( $dry)
void setFrom ( $from)
void setSubject ( $subject)
void setTo ( $to)
Variables
string $body = '' (line 74)

Buffer which holds the email contents before it is sent.

- access: protected

boolean $dry = false (line 68)

Indiciates whether this appender should run in dry mode.

- deprecated:
- access: protected

string $from = null (line 49)

Email address to put in From field of the email.

- access: protected

string $subject = 'Log4php Report' (line 55)

The subject of the email.

- access: protected

string $to = null (line 61)

One or more comma separated email addresses to which to send the email.

- access: protected

#### Inherited Variables

Inherited from LoggerAppender

> LoggerAppender::$closed
> LoggerAppender::$filter
> LoggerAppender::$layout
> LoggerAppender::$name
> LoggerAppender::$requiresLayout
> LoggerAppender::$threshold

Methods
append (line 76)

- access: public

void append (LoggerLoggingEvent $event)

- LoggerLoggingEvent $event

Redefinition of:

LoggerAppender::append()
  Forwards the logging event to the destination.

close (line 82)

- access: public

void close ()

Redefinition of:

LoggerAppender::close()
  Releases any resources allocated by the appender.

getFrom (line 128)

Returns the 'from' parameter.

- access: public

void getFrom ()
getSubject (line 108)

Returns the 'subject' parameter.

- access: public

void getSubject ()
getTo (line 118)

Returns the 'to' parameter.

- access: public

void getTo ()
setDry (line 133)

Enables or disables dry mode.

- access: public

void setDry ( $dry)

- $dry

setFrom (line 123)

Sets the 'from' parameter.

- access: public

void setFrom ( $from)

- $from

setSubject (line 103)

Sets the 'subject' parameter.

- access: public

void setSubject ( $subject)

- $subject

setTo (line 113)

Sets the 'to' parameter.

- access: public

void setTo ( $to)

- $to

#### Inherited Methods

Inherited From LoggerAppender

> LoggerAppender::__construct()
> LoggerAppender::activateOptions()
> LoggerAppender::addFilter()
> LoggerAppender::append()
> LoggerAppender::clearFilters()
> LoggerAppender::close()
> LoggerAppender::doAppend()
> LoggerAppender::getDefaultLayout()
> LoggerAppender::getFilter()
> LoggerAppender::getFirstFilter()
> LoggerAppender::getLayout()
> LoggerAppender::getName()
> LoggerAppender::getThreshold()
> LoggerAppender::isAsSevereAsThreshold()
> LoggerAppender::requiresLayout()
> LoggerAppender::setLayout()
> LoggerAppender::setName()
> LoggerAppender::setThreshold()
> LoggerAppender::warn()
> LoggerAppender::__destruct()

Inherited From LoggerConfigurable

> LoggerConfigurable::setBoolean()
> LoggerConfigurable::setFileSize()
> LoggerConfigurable::setInteger()
> LoggerConfigurable::setLevel()
> LoggerConfigurable::setNumeric()
> LoggerConfigurable::setPositiveInteger()
> LoggerConfigurable::setString()
> LoggerConfigurable::warn()

Documentation generated on Mon, 02 Feb 2026 13:59:50 +0900 by phpDocumentor 1.4.4