def canonical_write( str )
      ### build a mail header for RFC 822
      rfc822msg =  "From: #{@from}\n"
      rfc822msg << "To: #{@to.join(",")}\n"
      rfc822msg << "Subject: #{@subject}\n"
      rfc822msg << "Date: #{Time.new.rfc822}\n"
      rfc822msg << "Message-Id: <#{"%.8f" % Time.now.to_f}@#{@domain}>\n\n"

      rfc822msg = rfc822msg.force_encoding(encoding) if encoding and rfc822msg.encoding != encoding
      rfc822msg << str

      ### send email
      smtp = Net::SMTP.new(@address, @port)
      smtp.enable_starttls_auto if @enable_starttls_auto and smtp.respond_to? :enable_starttls_auto
      smtp.start(@domain, @user_name, @password, @authentication) { |s| s.sendmail(rfc822msg, @from, @to) }
      self
    rescue StandardError, TimeoutError => err
      self.level = :off
      ::Logsly::Logging182.log_internal {'e-mail notifications have been disabled'}
      ::Logsly::Logging182.log_internal(-2) {err}
    end
def canonical_write( str )
      ### build a mail header for RFC 822
      rfc822msg =  "From: #{@from}\n"
      rfc822msg << "To: #{@to.join(",")}\n"
      rfc822msg << "Subject: #{@subject}\n"
      rfc822msg << "Date: #{Time.new.rfc822}\n"
      rfc822msg << "Message-Id: <#{"%.8f" % Time.now.to_f}@#{@domain}>\n\n"

      rfc822msg = rfc822msg.force_encoding(encoding) if encoding and rfc822msg.encoding != encoding
      rfc822msg << str

      ### send email
      smtp = Net::SMTP.new(@address, @port)
      smtp.enable_starttls_auto if @enable_starttls_auto and smtp.respond_to? :enable_starttls_auto
      smtp.start(@domain, @user_name, @password, @authentication) { |s| s.sendmail(rfc822msg, @from, @to) }
      self
    rescue StandardError, TimeoutError => err
      self.level = :off
      ::Logsly::Logging182.log_internal {'e-mail notifications have been disabled'}
      ::Logsly::Logging182.log_internal(-2) {err}
    end
This method is called by the buffering code when messages need to be
 sent out as an email.