public void PurgeOldIncomingMailsFiles(IList <Guid> contentIds) { foreach (var contentId in contentIds) { try { IncomingMailDTO.DeleteContentFile(contentId); } catch { } } // Drop any missed mail folders var zombieThreshold = DateTime.UtcNow.AddMinutes(-2 * Configuration.Instance.TimeToLiveInMinutes); var incomingMailDirectory = new DirectoryInfo(Configuration.Instance.IncomingMailDirectory); foreach (var incomingMail in incomingMailDirectory.GetFiles()) { if (incomingMail.LastWriteTimeUtc < zombieThreshold) { try { File.Delete(incomingMail.FullName); } catch { } } } }
private void DeleteIncomingMail(IDbConnection c, IncomingMailDTO m) { c.Execute("delete from IncomingMail where Id=@Id", m); m.DeleteContentFile(); }