def _addMailHandlerToLogger(logger, smtpServer, fromAddr, toAddrs, emailSubject, username=None, password=None, secure=None):
    '\n    Configure a logger with a handler that sends emails to specified\n    addresses.\n\n    The format of the email is defined by L{LogFactory.EMAIL_FORMAT_STRING}.\n\n    @note: Any SMTPHandler already connected to the logger will be removed.\n\n    @param logger: The logger to configure\n    @type logger: A logging.Logger instance\n    @param toAddrs: The addresses to send the email to.\n    @type toAddrs: A list of email addresses that will be passed on to the\n        SMTPHandler.\n    '
    if (smtpServer and fromAddr and toAddrs and emailSubject):
        mailHandler = CustomSMTPHandler(smtpServer, fromAddr, toAddrs, emailSubject, (username, password), secure)
        mailHandler.setLevel(logging.ERROR)
        mailFormatter = logging.Formatter(EMAIL_FORMAT_STRING)
        mailHandler.setFormatter(mailFormatter)
        logger.addHandler(mailHandler)
Configure a logger with a handler that sends emails to specified
addresses.

The format of the email is defined by L{LogFactory.EMAIL_FORMAT_STRING}.

@note: Any SMTPHandler already connected to the logger will be removed.

@param logger: The logger to configure
@type logger: A logging.Logger instance
@param toAddrs: The addresses to send the email to.
@type toAddrs: A list of email addresses that will be passed on to the
    SMTPHandler.
def _addMailHandlerToLogger(logger, smtpServer, fromAddr, toAddrs, emailSubject, username=None, password=None, secure=None):
    '\n    Configure a logger with a handler that sends emails to specified\n    addresses.\n\n    The format of the email is defined by L{LogFactory.EMAIL_FORMAT_STRING}.\n\n    @note: Any SMTPHandler already connected to the logger will be removed.\n\n    @param logger: The logger to configure\n    @type logger: A logging.Logger instance\n    @param toAddrs: The addresses to send the email to.\n    @type toAddrs: A list of email addresses that will be passed on to the\n        SMTPHandler.\n    '
    if (smtpServer and fromAddr and toAddrs and emailSubject):
        mailHandler = CustomSMTPHandler(smtpServer, fromAddr, toAddrs, emailSubject, (username, password), secure)
        mailHandler.setLevel(logging.ERROR)
        mailFormatter = logging.Formatter(EMAIL_FORMAT_STRING)
        mailHandler.setFormatter(mailFormatter)
        logger.addHandler(mailHandler)