/// <summary> /// Sends email having the summary of the processsed file. /// </summary> /// <param name="errorMessage"> error message for email body</param> /// <param name="transactionStatus">Transation status</param> /// <param name="logFilePath">Path of log file</param> /// <param name="processedFileName">Preocessed file name</param> private void SendEmail(string errorMessage, string transactionStatus, string logFilePath, string processedFileName) { try { EmailHelper emlHelper = new EmailHelper(); emlHelper.EmailRecipients = this.serviceManager.EmailRecepients; emlHelper.EmailSender = this.serviceManager.EmailSender; emlHelper.SMTPPort = Convert.ToInt32(this.serviceManager.SMTPPort); emlHelper.SMTPServer = this.serviceManager.SMTPServer; emlHelper.SendEmail(errorMessage, logFilePath, transactionStatus, processedFileName); } catch (Exception ec) { _Logger.Error(ec.Message); } }
private void HandleErrorAndSendMail(long errorBatchID, string errorMessage) { if (logger.IsDebugEnabled) { logger.Debug(string.Format("HandleErrorAndSendMail({0})", errorBatchID)); } try { EmailHelper emailInteractions = new EmailHelper(); emailInteractions.DoSendEmail = this.DoSendEmail == null || this.DoSendEmail.Length <= 0 ? false : Convert.ToBoolean(this.DoSendEmail); emailInteractions.EmailRecipients = this.EmailRecipients; emailInteractions.EmailSender = this.EmailSender; emailInteractions.SMTPDomain = this.SMTPDomain; emailInteractions.SMTPUser = this.SMTPUser; emailInteractions.SMTPEncryptedPassword = this.SMTPEncryptedPassword; emailInteractions.SMTPPort = this.SMTPPort == null ? 0 : Convert.ToInt16(this.SMTPPort); emailInteractions.SMTPServer = this.SMTPServer; emailInteractions.SendEmail(errorBatchID, errorMessage); } catch (Exception ex) { logger.Error(string.Format("HandleErrorAndSendMail - {0}", ex.Message)); } }