예제 #1
0
        public static void EmailModuleSample()
        {
            // Configuring smtp server
            var smtpServerConfiguration = new SmtpServerConfiguration("userName", "password", "smtp.gmail.com", 587);

            // Creating a module
            var emailSenderLoggerModule = new EmailSenderLoggerModule(smtpServerConfiguration)
            {
                EnableSsl = true,
                Sender = "*****@*****.**"
            };

            // Add the module and it works
            emailSenderLoggerModule.Recipients.Add("*****@*****.**");

            //  // Simulation of exceptions
            Logger.Modules.Install(emailSenderLoggerModule);

            try
            {
                // Simulation of exceptions
                throw new NullReferenceException();
            }
            catch (Exception exception)
            {
                // Log exception
                // If you catch an exception error -> will be sent an email with a list of log message.
                Logger.Log(exception);
            }
        }
        public EmailSenderLoggerModule(SmtpServerConfiguration smtpServerConfiguration, string subject, ILoggerFormatter loggerFormatter)
        {
            _smtpServerConfiguration = smtpServerConfiguration;
            _subject = subject;
            _loggerFormatter = loggerFormatter;

            Recipients = new List<string>();
        }
        public EmailSenderLoggerModule(SmtpServerConfiguration smtpServerConfiguration, string subject, ILoggerFormatter loggerFormatter)
        {
            _smtpServerConfiguration = smtpServerConfiguration;
            _subject         = subject;
            _loggerFormatter = loggerFormatter;

            Recipients = new List <string>();
        }
 public EmailSenderLoggerModule(SmtpServerConfiguration smtpServerConfiguration, ILoggerFormatter loggerFormatter)
     : this(smtpServerConfiguration, GenerateSubjectName(), loggerFormatter)
 {
 }
 public EmailSenderLoggerModule(SmtpServerConfiguration smtpServerConfiguration, string subject)
     : this(smtpServerConfiguration, subject, new DefaultLoggerFormatter())
 {
 }
 public EmailSenderLoggerModule(SmtpServerConfiguration smtpServerConfiguration)
     : this(smtpServerConfiguration, GenerateSubjectName())
 {
 }
 public EmailSenderLoggerModule(SmtpServerConfiguration smtpServerConfiguration, ILoggerFormatter loggerFormatter)
     : this(smtpServerConfiguration, GenerateSubjectName(), loggerFormatter)
 {
 }
 public EmailSenderLoggerModule(SmtpServerConfiguration smtpServerConfiguration, string subject)
     : this(smtpServerConfiguration, subject, new DefaultLoggerFormatter())
 {
 }
 public EmailSenderLoggerModule(SmtpServerConfiguration smtpServerConfiguration)
     : this(smtpServerConfiguration, GenerateSubjectName())
 {
 }