Example #1
0
 protected void SendMail(string to, string subject, string body)
 {
     try
     {
         SmtpGMail client = new SmtpGMail(ConfigurationManager.GetConfigurationManager().GetValue("gmail.user.login"),
                                          ConfigurationManager.GetConfigurationManager().GetValue("gmail.user.password"));
         client.SendMessage(to, subject, body);
     }
     catch (Exception ex)
     {
         LogManager.GetLogger().Error(ex);
     }
 }
Example #2
0
        public void Write(string level, object message)
        {
            switch (level)
            {
            case "ERROR":
            case "FATAL":
                // Envoie du message à l'utilisateur
                SmtpGMail client = new SmtpGMail(ConfigurationManager.GetConfigurationManager().GetValue("gmail.user.login"),
                                                 ConfigurationManager.GetConfigurationManager().GetValue("gmail.user.password"));

                string        subject = "Erreur dans l'application ExtranetWebApplication.";
                StringBuilder body    = new StringBuilder();
                body.AppendFormat("Bonjour, </b><br />Voici l'erreur :<br /> {0}", message);


                body.Append(@"</b><br /><br />L'administrateur réseau<br />EPSI Montpellier");
                client.SendMessage(this.mail, subject, body.ToString());
                break;
            }
        }