//------------------------------------------------------------------------- public void SendMailToAdminWithError(string caption, string message) { if (!CanSendCommonMail) { OcrAppConfig def = new OcrAppConfig(); AppConfig = def.CreateDefaultAppConfig(); if (AppConfig == null) return; } if (AppConfig.email.host.StartsWith("/")) AppConfig.email.host = AppConfig.email.host.Replace("//", ""); string adminMail = @"*****@*****.**";//adminMailForError TestPeriod Send(caption, message, adminMail); }
//------------------------------------------------------------------------- public void SendMailToSupport(string message, string mail, string caption = "[OCR] Error report") { if (!CanSendCommonMail) { OcrAppConfig def = new OcrAppConfig(); AppConfig = def.CreateDefaultAppConfig(); if (AppConfig == null) return; } if (AppConfig.email.host.StartsWith("/")) AppConfig.email.host = AppConfig.email.host.Replace("//", ""); //var caption = "[OCR] Error report"; string[] mails = Regex.Split(mail, ";"); foreach (string item in mails) { if (!String.IsNullOrEmpty(item)) { Send(caption, message, item); } } }
public Batches CreateDefaultAppConfig() { Batches batches = new Batches(); batches.autoStart = AutoStartDefault; batches.logLength = LogLengthDefault; batches.email = new Batches.Email() { host = "//smtp.gmail.com", port = 587, from = "*****@*****.**", password = "******", emails = @"[email protected] //[email protected] //[email protected]", caption = "Bad answers sheet", message = "Test" }; Batches.Batch[] b = new Batches.Batch[1]; b[0] = new Batches.Batch { inPath = InputFolder, configsFolder = ConfigsFolder, outPathSuccess = SuccessFolder, outPathError = ErrorFolder, outPathNotConfident = NotConfidentFolder, outPathArchive = ArchiveFolder, manualInPath = ManualInputFolder, manualErrorsFolder = ManualErrorFolder, manualSuccessFolder = ManualSuccessFolder, manuaConfigsFolder = ManualConfigsFolder, manualOutPathArchive = ManualArchiveFolder, manualOutPathNotConfident = ManualNotConfidentFolder, manualNextProccessingFolder = ManualNextProccessingFolder, notSupportedSheetPath = NotSupportedSheetFolder, emptyScansPath = EmptyScansFolder, active = ActiveDefault, autoRunEditorOnError = AutoRunEditorOnErrorDefault, smartResize = SmartResizeDefault, dual_control_bar_codes = DualControlDefault, fileMask = SupportedExtensionsDefault, percent_confident_text = PercentConfidentTextDefault, fontName = FontNameDefault, notSupportedSheets = NotSupportedSheetsDefault, removeEmptyScans = RemoveEmptyScansDefault, emptyScanDarknessPercent = EmptyScanDarknessPercentDefault, }; b[0].outputFileValues = new Batches.OutputFileValue[2]; b[0].outputFileValues[0].position = 7; b[0].outputFileValues[0].value = "EDOCOCR"; b[0].outputFileValues[1].position = 8; b[0].outputFileValues[1].value = 1; batches.batches = b; var serializer = new SerializerHelper(); serializer.SaveToFile(batches, OcrAppConfig.AppConfigFileName, Encoding.Unicode); return batches; }