private function logEmail($email, $sent)
    {

        $message = "\nEmail sent at " . date('m/d/y h:i:s');
        $message .= "\nFrom:" . $email->from . '@' . $this->remote_addr;
        $message .= "\nTo: " . $email->to;
        foreach ($email->cc as $cc) {
            $message .="\nCc:" . $cc;
        }
        foreach ($email->bcc as $bcc) {
            $message .="\nBcc:" . $bcc;
        }
        $message .= "\nSubject: " . $email->subject;
        $message .= "\nAttachments: " . count($email->attachments) . ' ';
        if ($this->log_body) {
            $message .= "\nBody: " . $email->body;
            $message .= "\nBody_HTML: " . $email->body_HTML;
        }

        $names = Array();
        foreach ($email->attachments as $attachment) {
            $names[] = $attachment->name;
        }

        $message .= "(" . \implode(",", $names) . ")";

        if ($sent) {
            return $this->logger->sbEmailWriterSent($message);
        } else {
            return $this->logger->sbEmailWriterError($message);
        }
    }