'Sends message based on arguments and instance\'s properties.
Parameters
subject : str
Subject of the email.
text : str
Body of the email.
Raises
SMTPConnectionError
Error on connecting to host.
SMTPAuthenticationError
Error authenticating with SMTP server.
SMTPException
See Python `smtplib` for full list of other possible
exceptions.'

def _sendMessage(self, subject, text):

    msg = MIMEText(text)
    msg['Subject'] = subject
    msg['From'] = formataddr((self.fromname, self.fromaddr))
    msg['To'] = self.toaddr
    msg['Date'] = formatdate()
    smtp = smtplib.SMTP()
    try:
        self._logSys.debug("Connected    to    SMTP    '%s',    response:    %i:    %s", self.host, *smtp.connect(self.host))
        if (self.user and self.password):
            smtp.login(self.user, self.password)
        failed_recipients = smtp.sendmail(self.fromaddr, self.toaddr.split(',    '), msg.as_string())
    except smtplib.SMTPConnectError:
        self._logSys.error("Error    connecting    to    host    '%s'", self.host)
        raise
    except smtplib.SMTPAuthenticationError:
        self._logSys.error("Failed    to    authenticate    with    host    '%s'    user    '%s'", self.host, self.user)
        raise
    except smtplib.SMTPException:
        self._logSys.error("Error    sending    mail    to    host    '%s'    from    '%s'    to    '%s'", self.host, self.fromaddr, self.toaddr)
        raise
    else:
        if failed_recipients:
            self._logSys.warning("Email    to    '%s'    failed    to    following    recipients:    %r", self.toaddr, failed_recipients)
        self._logSys.debug("Email    '%s'    successfully    sent", subject)
    finally:
        try:
            self._logSys.debug("Disconnected    from    '%s',    response    %i:    %s", self.host, *smtp.quit())
        except smtplib.SMTPServerDisconnected:
            pass
