3000AD Knowledge Base
Home » Categories » Knowledge Base Home » PDF-eXPLODE » Tips N Tricks

How can I automatically SEND all my emails in the DRAFTS folder of MS Outlook?


 I inadvertently set my PDF-eXPLODE email connection configuration to go to the  DRAFTS folder of MS Outlook (MAPI connection). I have tried dragging the emails from DRAFTS to OUTBOX folder and then clicking the SEND/RECEIVE button, but nothing happened.  Now I believe I have to open each 'draft' email manually and then click SEND. I have more than 500 emails in the DRAFTS folder awaiting SEND. I need a way to send these automatically without having to open each one and click SEND thereby avoiding hours of work.  Can this be done?



MS Outlook allows you to save many emails into the DRAFTS folder. However, there is no standard functionality that exists to be able to send those emails automatically in bulk, no ' SEND DRAFT EMAILS' button; however this can be achieved by copying and pasting the VBA program code below into a Outlook macro and assigning the macro to an Outlook ' Quick Access Toolbar  ' button. Some of the following tip comes from https://www.datanumen.com/blogs/

  1. Press  [ALT + F11]  to access the shortcut for the Visual Basic (VBA) editor interface.
  2. If you see just the VBA Project name in bold on the Left Hand pane, then right click on the project name, and select Insert  and in the fly-out menu, select Module   OR
  3. If you see a menu item ' Modules ' under the Project name, you can alternatively right click on Modules and on the drop down menu, select Insert and in the fly out menu, click on Module  (as in this image below) which will open a new code screen on the right window pane. Either of #2 or #3 is suitable for creating a blank Module in the right hand pane.


  4. Now copy all the code (beginning with ' Public Declare... ' and continue to copy  Sub SendAllDraftEmails() to End Sub )  from the yellow window below.  

     NOTE:  if you are using a 64Bit version of MS Outlook, then you may get an error as follows "The code in this project must be updated for use on 64 bit systems.". This error is pointing to the line "Public Declare Sub Sleep Lib "kernel32 (ByVal Milliseconds As Long)". Then change this line to read: Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) 
    Source Code Title

    Public Declare Sub Sleep Lib "kernel32" (ByVal Milliseconds As Long)


    Sub SendAllDraftEmails()

    Dim objDrafts As Outlook.Items
    Dim objDraft As Object
    Dim strPrompt As String
    Dim nResponse As Integer
    Dim i As Long
    Dim merror As Integer, Gcount As Integer

    On Error GoTo err_handle

    Set objDrafts = Outlook.Application.Session.GetDefaultFolder(olFolderDrafts).Items
    Gcount = objDrafts.Count

    If objDrafts.Count > 0 Then
           strPrompt = "Are you sure you want to send out all the drafts?"
           nResponse = MsgBox(strPrompt, vbQuestion + vbYesNo, "Confirm Sending")

           If nResponse = vbYes Then
                For i = objDrafts.Count To 1 Step -1

                    ' **** USE ONLY ON LARGE BATCHES OF (say) 500+ emails if you need to slow the program speed down ****
                    ' **** this next line will PAUSE the program for 2 seconds before sending the NEXT Draft email **

                    ' Sleep 2000

               strPrompt = "You opted NOT to send any Draft emails"
               nResponse = MsgBox(strPrompt, vbInformation + vbOKOnly, "Confirm Sending")
              GoTo exit_for

          End If

          If merror > 0 And merror = Gcount Then
                 MsgBox "No Draft Emails Sent!", vbCritical, "Email Sending Errors!"
          ElseIf merror > 0 And merror < Gcount Then
                 MsgBox "Some Draft Emails were sent - " & Trim(Str(merror)) & " emails were not sent", vbCritical, "Email Sending Errors!"
                 MsgBox "All Draft Emails Sent!", vbInformation, "Email Sending"
          End If
          MsgBox "No Draft Emails Found!", vbExclamation, "No Draft Emails Found"
    End If

    Exit Sub


    If Err = "-2147467259" Then
         MsgBox "There must be at least one email address or contact group in the TO, CC or BCC fields" & vbCrLf & "Fix it and re-run your emails", vbExclamation, "Error in Email Address!"
         merror = 1 + merror
         Resume Next
    End If


    End Sub

  5. Now paste the copied code into the white background VB code window in Outlook. then click the SAVE button.

  6. Finally, click menu FILE/ Close and Return to Microsoft Outlook  .

The above screen shows you how your program code (white) window will look after you pasted a copy of the code from the yellow window. (The above is a MS Outlook 2010 window)

Highlight the project name at the top (in bold) in the left-hand pane and then change the name of the project in the Properties  window below in the left hand pane - see image below



We now have to assign a button to this macro on to the Quick Access Toolbar in Outlook

  • Go to menu  File  --> Options --> Quick Access Toolbar  tab.
  • Now follow the steps shown in the picture below to add the new macro to Quick Access Toolbar.
    1. In the drop down 'Choose command from:',  select Macros
    2. In the box below, select the 'SendAllDraftEmails' and click Add..
    3. SendAllDraftEmails  code item will move to the righthand window and will be assigned a default icon on the Toolbar.
    5. To change the default icon assigned to the macro, click on the MODIFY button once you select/highlight the Macro name.
    6. Click OK button to exit the Quick Access Toolbar configuration screen. Once you exit, you will see the Quick Access Toolbar with a new button, as indicated by the red arrow in this image below.

  • Note -   If you have more than one email account in Outlook, then the 'DRAFTS' folder is taken to be the DRAFTS folder for the  default email address. You can change your default to process emails in a different DRAFTS email folder (select FILE menu/Info/Account Settings  and when the email account listing window opens, highlight the email account and click Set as Default


  • Now click the Macro button in the Quick Access Toolbar  to commence processing/sending emails.




If you want to exclude some of the emails in the Drafts folder from sending at this time, make a sub folder in Drafts like "On Hold". Then drag the emails you don't want to send into this sub folder. They will not get sent and when you are ready, just drag them back into the Drafts folder, then click your macro 'SendAllDraftEmails' run button.


This code is set up as a Macro within MS Outlook. Depending on your security setting for Macros, this Macro may not run at all. Contact your IT personnel if unsure. Here is where you can check your Macro settings: In MS Outlook, click on the menu File /  Option / Trust Center. Next click on the button TRUST CENTER SETTINGS.... Next click on the Macro Settings menu item on the left pane:

The last two options will work with this program code.



As stated earlier in this KB article, if you have more than one email account set up in MS Outlook (see FILE/INFO/ACCOUNT SETTINGS) , then the 'SendAllDraftEmails' button will only send the emails from the Drafts folder of the account set as default.



If you have a paid PDF-eXPLODE Annual Support Plan, you can email us at support@3000ad.com.au for help with any issue(s) you are having in getting this working. 




Comments Comments (18)
Comment by mostafa on Tue, Oct 20th, 2020 at 11:17 PM
this code is very good but i have a question and a different request i have many email in draft from account1 but i whant to sent them with account 2 what shouid i do?
Comment by Mark Fonseca on Sat, Aug 8th, 2020 at 5:52 AM
This article has been written several years ago and has been thoroughly tested by thousands of Users across many countries and environments. Whilst every effort is made to accurately test and represent a solution in this Knowledge Base, no solution can ever be 100% suitable to all environments and PCs. For this reason the solution is provided AS-IS and without any warranty or support. However, you may be best to check the following: 1. When you start MS Outlook, are you connected to multiple mail boxes?. If so, only ONE is your default mail box preference and it is from this mail box where any Draft email will be sent. Please check your current default mail box draft folder for any draft emails pending. If another box contains draft emails and it is not the Default, then set that box to be the Default and click the ‘Send‘ on the macro icon 2. If #1 is not your issue, please review your Macro settings to determine if this has changed and your settings appears as Disable all macros without notifications€. If so, change to option Notifications for all macros€. You can access Macro menu by selecting in Outlook : FILE (menu) /Options/Trust Center/Trust Center Setting (button click) /Macro Settings
Comment by Harsh Chavda on Wed, Aug 5th, 2020 at 10:08 PM
Hi, It worked fine for first few days and then stopped working, I have tried removing it and repeating the process, but no positive result. Can anyone help with this?
Comment by A Smith on Thu, May 2nd, 2019 at 3:04 AM
Omg! thank you for this! No more clicking Send 175 times in a row :D
Comment by Kevin on Thu, Feb 28th, 2019 at 9:48 PM
The script is working. Thank you very much!
Comment by Mark Fonseca on Tue, Feb 12th, 2019 at 2:58 PM
Read the Tip in the article about selecting a Drafts folder by setting the Default mail account from menu : File /Info/Account Settings
Comment by Simone Mancini on Wed, Feb 6th, 2019 at 7:43 PM
I have multiple mailbox connected to my outlook, my personal one and a couple of group mailboxex shared with all my team work, the Code is working fine with my personal default account, Is there any possibility to select another "drafts" folder where the messages are stored? thanks
Comment by Mark Fonseca on Thu, Sep 13th, 2018 at 6:01 PM
Tradie Turikye - MS Outlook is not "hung" or frozen. It appears like that because you have a long 10 second PAUSE in between sending each Email and there is no progress meter in the code to show you the progress of a large batch of DRAFT emails.
Comment by Trader Turkiye on Tue, Sep 11th, 2018 at 11:09 PM
Hello there. The problem has been solved and I thank you for that. The Outlook application freezes during the process, but the process is successful. Thank you..
Comment by Mark Fonseca on Tue, Sep 11th, 2018 at 9:34 AM
@Trader Turkiye, you can apply a "wait" or "sleep" command while the programming is looping through each DRAFT email and after it SENDS it will stop for some seconds. This is what you can do (I have tested this in MS Outlook 2010 and I hope it works in other versions from 2007 - 2013 (but no guarantee!) At the top of the yellow screen you copied, press ENTER twice to create blank lines. Then paste this line AT THE TOP: Public Declare Sub Sleep Lib "kernel32" (ByVal Milliseconds As Long) and hit [ENTER] - A line will appear below that pasted line. Now replace these lines : If nResponse = vbYes Then For i = objDrafts.Count To 1 Step -1 objDrafts.Item(i).Send Next End If WITH THIS: If nResponse = vbYes Then For i = objDrafts.Count To 1 Step -1 objDrafts.Item(i).Send Sleep 5000 Next End If Sleep 5000 means pause for 5 seconds as 1000 milliseconds = 1 sec and 5000 milliseconds = 5 secs etc. Now the program will pause for 5 seconds after each DRAFT email sent. Regards Mark
Comment by Trader Turkiye on Wed, Sep 5th, 2018 at 1:43 AM
Hello there, I use the following Macro code to send mail that is located in Outlook‘s draft folder. I want to make a certain period of time while sending mail from the Draft folder. So I would like to send by waiting 5-10 seconds between the mails. There are sometimes over 1000 emails in the draft box. Can I fix this by modifying the following code? Thank you in advance for your help.
Comment by Mark Fonseca on Tue, Jul 24th, 2018 at 2:48 AM
If you send an email with embedded images to the DRAFTS folder instead of direct sending, MS Outlook removes the embedded images and places them as attachments. This will then require you to manually fix this (by re-embedding the image) and sending them one by one. The code supplied above will not resolve this problem.
Comment by Mihai-Gabriel Albert on Fri, Jul 20th, 2018 at 7:55 PM
if I have pictures in the email that are stored on my pc and referenced in email body, when I run the macro the pictures are not sent.
Comment by Mark Fonseca on Thu, Apr 5th, 2018 at 7:44 PM
In response to Paul‘s comment, the error he is getting is "This method can‘t be used with an inline response mail item." This error is specific to Outlook 2013. It means that the Draft email has either been opened and is therefore "in use" or the preview panel is open and the Draft email is highlighted in the drafts folder. In Outlook 2010, you don‘t get any error if the Draft email is highlighted in the folder and the preview panel is open. To fix the problem, turn off your preview pane and do not leave any email (to be sent) highlighted. Thanks to Paul for his assistance in debugging the problem. Mark
Comment by Paul Hetherington on Tue, Apr 3rd, 2018 at 5:15 PM
Receiving the same error as Alexander but only on the last email in drafts to be sent (using the above code shown in the Send_All_Draft_Emails) [Win7 64bit, Outlook 2013]
Comment by Mark Fonseca on Sat, Feb 17th, 2018 at 12:55 PM
Fixed the issue mentioned by Alexander Kos where if a draft email does not contain TO, CC, or a BCC address, it would error.
Comment by Alexander Kos on Wed, Feb 7th, 2018 at 7:52 PM
Run-time error There must be at least one name or contact group in to,cc, or Bcc box. There is a correct email in To: Win7 Professional 64 bit, 32 bit Outlook Professional Plus 2010
Comment by Nikki on Wed, Oct 4th, 2017 at 6:40 PM
Security Code Security Code

Subscribe to Knowledge Base

Get notified when new articles are added to the knowledge base.