Exemple #1
0
        /// <summary>
        /// Deletes specified message.
        /// </summary>
        /// <param name="uid">Message UID.</param>
        private void DeleteMessage(long uid)
        {
            try {
                /* NOTE: In IMAP message deleting is 2 step operation.
                 *  1) You need to mark message deleted, by setting "Deleted" flag.
                 *  2) You need to call Expunge command to force server to dele messages physically.
                 */

                var sequenceSet = IMAP_t_SeqSet.Parse(uid.ToString());
                _client.StoreMessageFlags(true, sequenceSet, IMAP_Flags_SetType.Add, new IMAP_t_MsgFlags(IMAP_t_MsgFlags.Deleted));
                _client.Expunge();
            }
            catch (Exception ex) {
                //Debug.WriteLine(ex.Message);
                AppJournal.Write("EmailImapTransport: DeleteMessage: " + ex.Message);
            }
        }