/// <summary> /// Creates a copy of the current message in another folder /// </summary> /// <param name="folder">The folder where the message should be copied to</param> /// <param name="downloadCopy">If <code>true</code>, the copy of the message will be downloaded to target folder</param> /// <returns><code>true</code> if the message could be copied</returns> public bool CopyTo(Folder folder, bool downloadCopy = false) { if (folder == null) { throw new ArgumentNullException("folder"); } if (Folder.ReadOnly) { Folder.Select(); } IList <string> data = new List <string>(); if ( !_client.SendAndReceive(string.Format(ImapCommands.Copy, UId, folder.Path), ref data, this)) { return(false); } var m = Expressions.CopyUIdRex.Match(data.FirstOrDefault() ?? ""); if (m.Success) { folder.Search("UID " + m.Groups[3].Value); } return(true); }
/// <summary> /// Permanently removes all messages that have the \Deleted flag set from the current folder. /// </summary> /// <returns></returns> public bool Expunge() { Folder selectedFolder = _client.SelectedFolder; if (ReadOnly || (selectedFolder != null && !Equals(selectedFolder))) { Select(); } IList <string> data = new List <string>(); bool result = _client.SendAndReceive(ImapCommands.Expunge, ref data); if (selectedFolder != null && !Equals(selectedFolder)) { selectedFolder.Select(); } return(result); }