public void ProcessNotifications() { MimeReader mime = new MimeReader(); SmtpClient client = new SmtpClient(); try { var request = new RestRequest("notification/retrieve", Method.GET); logger.Log(NLog.LogLevel.Info, "<br/><font color=Orange>Send notifications starts........" + DateTime.Now.ToString()); IRestResponse<List<NotificationModel>> response = Client.Execute<List<NotificationModel>>(request); if (response!=null&& response.Data!=null) { foreach (NotificationModel not in response.Data) { if (File.Exists(not.NotificationFileName)) { logger.Log(NLog.LogLevel.Info, "<br/><font color=Orange>Indivivdual notifications starts........"); RxMailMessage mm = mime.GetEmail(not.NotificationFileName); client.Send(mm); File.Delete(not.NotificationFileName); request = new RestRequest("notification/update", Method.PUT); request.RequestFormat = DataFormat.Json; request.AddBody(new NotificationModel() { NotificationQueueId = not.NotificationQueueId, NotificationStatus = "2" }); var response2 = Client.Execute(request); } } } else { logger.Log(NLog.LogLevel.Info, "<br/><font color=Orange>No response found for notifications"); } } catch(Exception ex) { logger.Log(NLog.LogLevel.Info, "<br/><font color=Red>"+ ex.StackTrace); throw; } finally { client.Dispose(); } }
public static RxMailMessage CreateFromStream(MimeReader mimeDecoder, Stream EmailStream) { return(mimeDecoder.GetEmail(EmailStream)); }
public static RxMailMessage CreateFromStream(Stream EmailStream) { MimeReader mimeDecoder = new MimeReader(); return(mimeDecoder.GetEmail(EmailStream)); }
public static RxMailMessage CreateFromFile(MimeReader mimeDecoder, string sEmlPath) { return(mimeDecoder.GetEmail(sEmlPath)); }