I have a need to search for a message based on a unique subject and if i find it, delete the message. How do i accomplish the delete part? searching for messages was self-explanatory. I can't seem to find a way to delete the message once i've found it.
What you need to do is to set the MessageFlags.Deleted flag on the message via folder.AddFlags (uid, MessageFlags.Deleted, true);
You may also want to purge the folder of deleted messages using folder.Expunge ();
Most helpful comment
What you need to do is to set the
MessageFlags.Deletedflag on the message viafolder.AddFlags (uid, MessageFlags.Deleted, true);You may also want to purge the folder of deleted messages using
folder.Expunge ();