function close()
    {
        if ($this->_opened) {
            if ($this->_shouldSend && !empty($this->_message)) {
                if ($this->_mailBackend === '') {  // use mail()
                    $headers = "From: $this->_from\r\n";
                    $headers .= 'User-Agent: PEAR Log Package';
                    if (mail($this->_recipients, $this->_subject,
                             $this->_message, $headers) == false) {
                        return false;
                    }
                } else {  // use PEAR::Mail
                    include_once 'Mail.php';
                    $headers = array('From' => $this->_from,
                                     'To' => $this->_recipients,
                                     'User-Agent' => 'PEAR Log Package',
                                     'Subject' => $this->_subject);
                    $mailer = &Mail::factory($this->_mailBackend,
                                             $this->_mailParams);
                    $res = $mailer->send($this->_recipients, $headers,
                                         $this->_message);
                    if (PEAR::isError($res)) {
                        return false;
                    }
                }

                /* Clear the message string now that the email has been sent. */
                $this->_message = '';
                $this->_shouldSend = false;
            }
            $this->_opened = false;
        }

        return ($this->_opened === false);
    }