title: how to clear outbox with vba in outlook, still got one outgoing email
body: <p>I want to "send" a message to specific recipient but do not want to deliver. The message is in the outbox but I want to delete it immediately. When I use the command delete it says it was deleted before sending. I do not want popups and also there is an alert when exiting Outlook that there are still unsent messages. How to clear outbox?</p>
  
  <pre><code>Private Sub Application_ItemSend(ByVal item As Object, Cancel As Boolean)
  
  Dim outApp As Outlook.Application
  Dim deletedFolder As Outlook.MAPIFolder
  Dim entryID As String
  
  Set outApp = CreateObject("outlook.application")
  Set deletedFolder  =outApp.GetNamespace("MAPI").GetDefaultFolder(olFolderOutbox)
  
  If item.To = "example@mail.com" Then
      item.DeferredDeliveryTime = DateAdd("y", 99999, Now)
  End If
  
  Set deletedFolder =    outApp.GetNamespace("MAPI").GetDefaultFolder(olFolderOutbox)
  
  If deletedFolder.Items.Count &gt;= 0 Then
      For i = 1 To deletedFolder.Items.Count
          deletedFolder.Items(1).Delete
      Next i
  End If
  
  End Sub
  </code></pre>