VBOffice

Purge Deleted IMAP Messages

See how to really delete IMAP messages with a single click.

Last modified: 2008/02/19 | Accessed: 8.321  | #64
◀ Previous sample Next sample ▶
SAM SAM
Determine the "identity" of your emails. Set with SAM the sender and the folder folder for sent items with the help of rules.

If you delete an IMAP message, it will be flagged deleted but stays in the folder. For really deleting it, you must do another click to purge the message. This macro does the purging for you. It works for up to Outlook 2010.


tip  How to add macros to Outlook
Sub PurgeFolder()
  'Delete all flagged messages from the current folder
  PurgeDeletedMessages 12771
End Sub

Sub PurgeAccount()
  Delete all flagged messages from the current account
  PurgeDeletedMessages 12772
End Sub

Sub PurgeAllAccounts()
  Delete all flagged messages from all accounts
  PurgeDeletedMessages 12773
End Sub

Private Sub PurgeDeletedMessages(ByVal Id As Long)
  On Error Resume Next
  Dim Bars As Office.CommandBars
  Dim Btn As Office.CommandBarButton

  Set Bars = Application.ActiveExplorer.CommandBars
  Set Btn = Bars.FindControl(, Id)
  If Not Btn Is Nothing Then
    Btn.Execute
  End If
End Sub
ReplyAll ReplyAll
ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the e-mail.
email  Send a message