public IEnumerable <SmtpMessage> Get() { App.Current.WaiteForEndOfAllSessions(); return(Directory.GetFiles(App.Current.MailFolderPath, "*.eml") .Select(path => SmtpMessage.CreateFrom(path)) .OrderByDescending(m => m.Date)); }
public SmtpMessage Get(Guid id) { App.Current.WaiteForEndOfAllSessions(); return(Directory.GetFiles(App.Current.MailFolderPath, "*.eml") .Select(path => SmtpMessage.CreateFrom(path)) .First(a => a.Id == id)); }
public static SmtpMessage CreateFrom(string path) { var msg = new SmtpMessage(); msg.Load(path); return(msg); }
public void Delete(Guid id) { var pathToDelete = Directory.GetFiles(App.Current.MailFolderPath, "*.eml") .Select(path => new { path, SmtpMessage.CreateFrom(path).Id }) .First(a => a.Id == id) .path; File.Delete(pathToDelete); // notify via SignalR var hubContext = SignalR.GlobalHost.ConnectionManager.GetHubContext <SmtpServerHub>(); SmtpServerHub.NotifyRemoveMessage(id, hubContext.Clients); }
public static object ToSimpleFormat(this SmtpMessage msg) { return(new { msg.Id, From = msg.From != null?msg.From.ToString() : "", To = msg.To.Select(_ => _.ToString()).ToArray(), CC = msg.CC.Select(_ => _.ToString()).ToArray(), msg.Subject, msg.Date, msg.Body, Attachments = msg.Attachments.Select(_ => _.Name).ToArray() }); }
public void Delete() { var hubContext = SignalR.GlobalHost.ConnectionManager.GetHubContext <SmtpServerHub>(); Directory.GetFiles(App.Current.MailFolderPath, "*.eml") .Select(path => new { path, SmtpMessage.CreateFrom(path).Id }) .ToList() .ForEach(m => { File.Delete(m.path); // notify via SignalR SmtpServerHub.NotifyRemoveMessage(m.Id, hubContext.Clients); }); }
internal void FireReceiveMessage(SmtpMessage message) { this.ReceiveMessage(this, new ReceiveMessageEventArgs(message)); }
public ReceiveMessageEventArgs(SmtpMessage message) { this.Message = message; }
public ReceiveMessageEventArgs(SmtpMessage message) { this.Message = message; }
public static void NotifyReceiveMessage(SmtpMessage message, IHubConnectionContext clients) { clients.All.ReceiveMessage(message.ToSimpleFormat()); }
internal void FireReceiveMessage(SmtpMessage message) { this.ReceiveMessage(this, new ReceiveMessageEventArgs(message)); }
public static SmtpMessage CreateFrom(string path) { var msg = new SmtpMessage(); msg.Load(path); return msg; }