public void DeleteMessage(MailMessage message, bool permanent = false) { message.Flags |= MailFlags.Deleted; // marke the message as deleted //first simuate deleting the item by moving it to the deleted folders if (!DeletedItems.Contains(message)) { DeletedItems.Add(message); } if (InboxItems.Contains(message)) { InboxItems.Remove(message); } if (DraftItems.Contains(message)) { DraftItems.Remove(message); } if (SentItems.Contains(message)) { SentItems.Remove(message); } if (permanent) { if (DeletedItems.Contains(message)) { DeletedItems.Remove(message); } } }
public void SaveDraft(MailMessage message) { message.Flags |= MailFlags.Draft; //add the draft flag if (!DraftItems.Contains(message)) { DraftItems.Add(message); } }