public void ErrorLogTest() { Aybala.DTO.Net.MailObject mail = new DTO.Net.MailObject(); Aybala.DTO.Net.ReceiverObject receiver = new DTO.Net.ReceiverObject(); Assert.IsTrue(Aybala.Tool.Logger.ErrorLog.CreateLog("Test", "test", "Deneme", Tool.Logger.RegisterType.Mail, new System.Collections.Generic.List<string>() { "*****@*****.**", "*****@*****.**" })); }
private static bool Mail(ErrorLogObject errorLog, List<string> ReceiverMails) { bool result = false; try { Aybala.DTO.Net.ReceiverObject receiver = new DTO.Net.ReceiverObject(); receiver.Subject = "Hata Mesajı"; #region MailFormat string mailBody = @" Merhaba <br/> Dahil olduğunuz [[projectName]] projesi içerisinde [[moduleName]] modülünde bir hata oluştu. Hata detayları : <br/> <table> <tr> <td colspan='2'><hr /></td> </tr> <tr> <td><b>Proje Adı</b></td> <td>[[dProjectName]]</td> </tr> <tr> <td><b>Modül Adı</b></td> <td>[[dModuleName]]</td> </tr> <tr> <td><b>Sınıf Adı</b></td> <td>[[dFunction]]</td> </tr> <tr> <td><b>Fonksiyon</b></td> <td>[[dClassName]]</td> </tr> <tr> <td><b>Hata Kodu</b></td> <td>[[dExceptionCode]]</td> </tr> <tr> <td><b>Hata Mesajı</b></td> <td>[[dExceptionMessage]]</td> </tr> <tr> <td><b>Not</b></td> <td>[[dNote]]</td> </tr> <tr> <td><b>Açıklama</b></td> <td>[[dDescription]]</td> </tr> <tr> <td><b>Cihaz Bilgisi</b></td> <td>[[dDevice]]</td> </tr> <tr> <td><b>Kullanıcı Ip</b></td> <td>[[dUserIp]]</td> </tr> <tr> <td><b>Hata Zamanı</b></td> <td>[[dCreatedDate]]</td> </tr> <tr> <td colspan='2'><hr /></td> </tr> </table><br/> Hata ile en kısa sürede ilgilenmenizi rica ederiz. İyi Çalışmalar "; #endregion #region MailFormat Edit mailBody = mailBody.Replace("[[projectName]]", errorLog.ProjectName); mailBody = mailBody.Replace("[[moduleName]]", errorLog.Module); mailBody = mailBody.Replace("[[dProjectName]]", errorLog.ProjectName); mailBody = mailBody.Replace("[[dModuleName]]", errorLog.Module); mailBody = mailBody.Replace("[[dClassName]]", errorLog.ClassName); mailBody = mailBody.Replace("[[dFunction]]", errorLog.Function); mailBody = mailBody.Replace("[[dExceptionCode]]", errorLog.ExceptionCode); mailBody = mailBody.Replace("[[dExceptionMessage]]", errorLog.ExceptionMessage); mailBody = mailBody.Replace("[[dNote]]", errorLog.Note); mailBody = mailBody.Replace("[[dDescription]]", errorLog.Description); mailBody = mailBody.Replace("[[dDevice]]", errorLog.Device); mailBody = mailBody.Replace("[[dUserIp]]", errorLog.UserIp); mailBody = mailBody.Replace("[[dCreatedDate]]", errorLog.Date.ToString()); #endregion receiver.Body = mailBody; foreach (var item in ReceiverMails) receiver.MailAddress += item + ","; receiver.MailAddress = receiver.MailAddress.Substring(0, receiver.MailAddress.Length - 1); result = Aybala.Tool.Net.Mail.Send(receiver); } catch (Exception) { result = false; throw; } return result; }