Globaldizajn.ErrorMailer 1.1.1

Web-application health monitoring module. Fires e-mails to target address on any uncaught exception

Install-Package Globaldizajn.ErrorMailer -Version 1.1.1
dotnet add package Globaldizajn.ErrorMailer --version 1.1.1
<PackageReference Include="Globaldizajn.ErrorMailer" Version="1.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Globaldizajn.ErrorMailer --version 1.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Custom Error Mailer

Error mailer koji jeste custom.

Podaci koje skuplja

(Taksativno nabrojani, idiomatski opisani)

  • Stack trace
  • Url (sada 30% više querystringa)
  • Rewriteani URL
  • Post podatci
  • Keyevi u sessionu
  • Godišnjice braka
  • Odgovore na pitanja o postojanju
  • Serijaliziranje request objekta (Za hoardera u vašem životu)

U fullDump modu:

  • Potpuni session dump (Json serialized)
  • Potpuni cache dump (moar json)

Install

  • https://www.nuget.org/packages/Globaldizajn.ErrorMailer/
  • ili skinuti DLL iz bina i postaviti ovo u web-conf
    <system.webServer>
        <modules>
        <add name="ErrorMailer" type="Globaldizajn.HealthMonitoring.ErrorMailer" />
        </modules>
    </system.webServer>
    

Config

  • U global.asax-u se mogu postaviti ovi:
       <%@ Import Namespace="ErrorMailer.Globaldizajn.HealthMonitoring"%>
    
    
      <script RunAt="server">
    
      Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
      	   ErrorMailer.targetEmail = "jab.drugi@mail.hr"
          ErrorMailer.enableSsl = True
          ErrorMailer.smtp = "mail.test.com"
          ErrorMailer.username = "example@example.com"
          ErrorMailer.password = "123123"
          ErrorMailer.fromEmail = "example@test.hr"
          ErrorMailer.fromName = "error"
          'not setting this value defaults the subject to the application root folder name 
          ErrorMailer.subject = "somesubject"
          ErrorMailer.divHighlightedStyle = "background-color:#ffffcc;"
          ErrorMailer.divStyle = "background-color:#eee"
          ErrorMailer.fontHighlightedStyle = "color:#dd0000"
          ErrorMailer.fontExceptionStyle = "color:maroon"
      End Sub
      </script>
    
  • Slanje maila za hendlane iznimke (U try catchu, na primjer)
         Public Shared Sub fireMailForCaughtException(ex As Exception) 
  • Ako koristite neke specijalne postavke tipa queueing ili posebne mailer librarye, možete definirati svoju funkciju za slanje maila kroz ovaj interface:

  • (primjer je za Hangfire, može se staviti štogod)

          Imports System.Net.Mail
          Imports ErrorMailer.Globaldizajn.HealthMonitoring
          Imports Hangfire
    
    
          Public Class ErrorMailSender
              Implements customMailer
    
              Public Sub fireMail(body As String, subject As String) Implements customMailer.fireMail
                  BackgroundJob.Enqueue(Sub() fireMailSetup(body, subject))
              End Sub
    
              Public Shared Sub fireMailSetup(text As String, subject As String)
    
                  Dim mail As New MailMessage()
                  Dim SmtpServer As New SmtpClient("localhost")
                  mail.From = New MailAddress("lidless.eye@globaldizajn.hr", "error")
                  mail.To.Add("lovro.gamulin@globaldizajn.com")
    
                  mail.Subject = subject
                  mail.Body = text
                  mail.IsBodyHtml = True
    
                  SmtpServer.Send(mail)
              End Sub
          End Class
    
  • Nakon ove definicije, nova klasa se mora dodati u http modul u global.asaxu:

       <%@ Import Namespace="ErrorMailer.Globaldizajn.HealthMonitoring.ErrorMailer"%>
    
    
      <script RunAt="server">
    
      Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
          mailer = New ErrorMailSender
      End Sub
      </script>
    

Custom Error Mailer

Error mailer koji jeste custom.

Podaci koje skuplja

(Taksativno nabrojani, idiomatski opisani)

  • Stack trace
  • Url (sada 30% više querystringa)
  • Rewriteani URL
  • Post podatci
  • Keyevi u sessionu
  • Godišnjice braka
  • Odgovore na pitanja o postojanju
  • Serijaliziranje request objekta (Za hoardera u vašem životu)

U fullDump modu:

  • Potpuni session dump (Json serialized)
  • Potpuni cache dump (moar json)

Install

  • https://www.nuget.org/packages/Globaldizajn.ErrorMailer/
  • ili skinuti DLL iz bina i postaviti ovo u web-conf
    <system.webServer>
        <modules>
        <add name="ErrorMailer" type="Globaldizajn.HealthMonitoring.ErrorMailer" />
        </modules>
    </system.webServer>
    

Config

  • U global.asax-u se mogu postaviti ovi:
       <%@ Import Namespace="ErrorMailer.Globaldizajn.HealthMonitoring"%>
    
    
      <script RunAt="server">
    
      Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
      	   ErrorMailer.targetEmail = "jab.drugi@mail.hr"
          ErrorMailer.enableSsl = True
          ErrorMailer.smtp = "mail.test.com"
          ErrorMailer.username = "example@example.com"
          ErrorMailer.password = "123123"
          ErrorMailer.fromEmail = "example@test.hr"
          ErrorMailer.fromName = "error"
          'not setting this value defaults the subject to the application root folder name 
          ErrorMailer.subject = "somesubject"
          ErrorMailer.divHighlightedStyle = "background-color:#ffffcc;"
          ErrorMailer.divStyle = "background-color:#eee"
          ErrorMailer.fontHighlightedStyle = "color:#dd0000"
          ErrorMailer.fontExceptionStyle = "color:maroon"
      End Sub
      </script>
    
  • Slanje maila za hendlane iznimke (U try catchu, na primjer)
         Public Shared Sub fireMailForCaughtException(ex As Exception) 
  • Ako koristite neke specijalne postavke tipa queueing ili posebne mailer librarye, možete definirati svoju funkciju za slanje maila kroz ovaj interface:

  • (primjer je za Hangfire, može se staviti štogod)

          Imports System.Net.Mail
          Imports ErrorMailer.Globaldizajn.HealthMonitoring
          Imports Hangfire
    
    
          Public Class ErrorMailSender
              Implements customMailer
    
              Public Sub fireMail(body As String, subject As String) Implements customMailer.fireMail
                  BackgroundJob.Enqueue(Sub() fireMailSetup(body, subject))
              End Sub
    
              Public Shared Sub fireMailSetup(text As String, subject As String)
    
                  Dim mail As New MailMessage()
                  Dim SmtpServer As New SmtpClient("localhost")
                  mail.From = New MailAddress("lidless.eye@globaldizajn.hr", "error")
                  mail.To.Add("lovro.gamulin@globaldizajn.com")
    
                  mail.Subject = subject
                  mail.Body = text
                  mail.IsBodyHtml = True
    
                  SmtpServer.Send(mail)
              End Sub
          End Class
    
  • Nakon ove definicije, nova klasa se mora dodati u http modul u global.asaxu:

       <%@ Import Namespace="ErrorMailer.Globaldizajn.HealthMonitoring.ErrorMailer"%>
    
    
      <script RunAt="server">
    
      Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
          mailer = New ErrorMailSender
      End Sub
      </script>
    

Release Notes

Formatting and visual overhauls

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.1.1 543 11/13/2017
1.1.0 402 11/6/2017
1.0.9 457 7/25/2017
1.0.8 405 7/21/2017
1.0.7 523 7/5/2017
1.0.6 408 6/27/2017
1.0.5 471 6/20/2017