Outlook Draft Email Reminder

How many times have you either sat there wondering why someone hasn’t responded to an email you’ve sent or someone chases you asking why you haven’t replied to a certain email and in both cases the partial response is actually still in your Outlook drafts folder? Of course, you had every intention of sending that email but you got sidetracked and  then either Outlook got restarted after exiting or crashing, you logged off and back on, shutdown, etc. In both cases, that once open email is then no longer open on your desktop but hidden away in your drafts waiting for you to remember to send it – out of sight, out of mind!

Yes, it has happened to me on more than one occasion so I therefore decided to script a solution to it, or at least something that would politely remind you that you had draft emails that perhaps you might want to finish. I started off writing in VBA but I couldn’t get it to trigger at startup or asynchronously so I switched to PowerShell, which I much prefer anyway.

The script has a number of options but I would suggest that the easiest way to use it is to have it run at logon and give it parameters -waitForOutlook and -wait which  mean that it will wait for an Outlook process to start before it starts checking, although it doesn’t have to since it uses COM to instantiate an Outlook instance of its own anyway, and the -wait means that it will loop around rather than performing one check and exiting.

If it finds draft emails created in the last seven days, although this can be changed via the -withinDays option, a popup will be displayed, which will be on top of all other windows, asking if you want to open them:

outlook drafts

Clicking “Yes” will result in the emails being opened, giving you the opportunity to finally finish and send them. Selecting “No” will either cause the script to exit if the -nowait option isn’t specified or put it to sleep until either a new Outlook instance appears, for instance because you close the current one and at some point start another one, or until the nag timer expires. The nag option, triggered by using the -nag parameter with a value in minutes, will cause the script to remind you, via the popup, that there are drafts that could probably do with your attention.

As I believe the best way to run this is to have it run at logon and then continue to check for draft emails, I added options to install and uninstall it into the registry so that it will be run at logon to save you the hassle of doing this yourself. If you run the following command line, it will create a registry value “Outlook draft nagger” in HKCU\Software\Microsoft\Windows\CurrentVersion\Run, or HKLM  if you want it to run for all users and the -allusers option is specified:

& '.\Find Outlook drafts.ps1' -waitForOutlook -withinDays 7 -wait -install "Outlook Drafts Checker" -nag 120

This will nag the user if there are drafts created in the last seven days as soon as Outlook is launched and then nag again either if Outlook is relaunched in that session or every two hours. Alternatively, it could be setup as a scheduled task if preferred but you lose some of its responsiveness such as being able to nag immediately if a new Outlook process for that user is detected.

If you need to remove this autorun, simply run with -uninstall “Outlook draft nagger”.

The script is available on GitHub here and you use it entirely at your own risk although there’s not exactly a great deal of damage that it can wreak. None in fact, other than perhaps you finally finishing and sending an email that perhaps you shouldn’t but don’t blame the script for that, after all you can always delete draft emails rather than send them!


		
Advertisements

Taking and resizing a screen shot in an Outlook email directly

As an IT Consultant, I frequently have to send Outlook emails containing screenshots. In the old, old days, I’d press the PrintScreen key, paste into Paint (I will miss you old friend as you are seen to be retired), select what I needed and then paste into the email. Then along came the Snipping Tool which made things a little easier but it still means going away from your email and then coming back. Oh, and don’t go on about third-party tools – I stick with what’s built-in then I know I’ve got it wherever I go.

It seems to be a little known/used fact that you can add a screen capture button directly to the quick access toolbar (QAT) in all recent Microsoft Office products. So I added this to the QAT but what I then found myself doing for pretty much every screenshot was to shrink it which either involved dragging the resize points around or quite a few clicks and key presses in the email message which kind of cancelled out the ease of getting the image in there in the first place.

Taking VBA code I found here and here (I was going to write it from scratch but these were almost exactly what I needed so why reinvent this wheel thing?), I ended up with the following VBA code, placed in the ThisOutlookSession object (hit Alt F11 to bring up the Outlook VBA editor):

Public Sub Shrinker()
 Const wdInlineShapePicture = 3
 
 If TypeName(ActiveWindow) = "Inspector" Then
   If ActiveInspector.IsWordMail And ActiveInspector.EditorType = olEditorWord Then
     If ActiveInspector.WordEditor.Application.Selection.InlineShapes.Count > 0 Then
       For Each wrdShp In ActiveInspector.WordEditor.Application.Selection.InlineShapes
         If wrdShp.Type = wdInlineShapePicture Then
           wrdShp.ScaleHeight = wrdShp.ScaleHeight - 10
           wrdShp.ScaleWidth = wrdShp.ScaleWidth - 10
         End If
       Next
     End If
   End If
 End If
 
 Set wrdShp = Nothing

End Sub

You can then add a button to the QAT in an email compose window that calls this code:

outlook email macro commands QAT

Notice the “Screen Clipping” button which is added thus:

add screen clipping to qat

Which will then give you these toolbar buttons in your email compose window:

outlook email screen capturing

You can then click the screen capture icon when needed which will hide the email compose window, give you cross hairs to select the region you need and once released it will be pasted into your email, selected, which will come back into focus:

outlook email screen captured

If you need to resize then click on the QAT button you assigned to the Shrinker macro which will scale it down by 10% each time you click it. If you want to grow it again, just hit Ctrl Z to undo. If you need to enlarge rather than shrink, duplicate the macro and put +10 instead of -10 and assign this macro to the QAT too.

I hope this helps save you lots of time which it has for me. Don’t forget to save the macro – the easiest way is to close Outlook and click Yes when it asks whether to save ThisOutlookSession.

 

Fixing missing Outlook reminders

Ever found that you’ve missed a meeting because Outlook didn’t remind you? It has certainly happened to me and seems linked to copying and pasting appointments via dragon drop or if someone sends you a meeting request which doesn’t have a reminder set in it. So rather than risking missing something which might be vaguely important and incurring a colleague’s or customer’s wrath, I’ve written a VBA macro that will find and fix calendar items that do not have a reminder.

If it finds any non-all day appointments without reminders, it will prompt you once for the reminder time to set, in minutes with a default of 10, and then apply that too all appointments it found.

reminder prompt

One it has finished it will inform you what appointments it changed:

reminder fixer

You can run it manually from the VBA window or I like to add macros to the ribbon which you can do by right clicking on the ribbon and selecting “Customize the Ribbon”.

reminder macro in ribbon

The code can be downloaded here. I hope it will help you never unintentionally miss a meeting again!

Please note that I haven’t tested it when running in a US locale, as the macro constructs a date string to restrict appointments to those in the future, but I hope that the mechanism I’ve used will work. It will write debug to the Immediate window (view by pressing Ctrl G) in the VBA console.

Send To Mail recipient replacement

It has bugged me for years that Outlook, up to and including 2016, blocks the main Outlook window if you right-click on files in explorer and choose “Mail recipient” from the Send To menu. So if you leave this draft email open, you won’t get any new emails (which isn’t necessarily a bad thing, for a while!). I therefore decided to fix it, or rather provide an alternative, by writing a PowerShell script.

The script is available here and it can be used to install itself into the running user’s SendTo menu by creating a shortcut that invokes powershell.exe on the script:

& '.\Send Outlook Email.ps1' -install "Mail recipient"

This will replace the existing “Mail recipient” shortcut, as long as you also specify the -overwrite option, but you can leave it in place and create a new shortcut for this script simply by giving a different name to the -install argument.

Should you want to, the original shortcut can be restored thus:

& '.\Send Outlook Email.ps1' -install "Mail recipient" -restore

or if you’ve created an additional shortcut, rather than replacing the default one, use -delete instead of -restore.

The additional features it provides are:

  1. It will make copies to “.txt” files of scripts, which would normally be blocked, such as .vbs or .cmd (the list of file types can be changed in the script)
  2. It will put binary files such as .exe files, which would normally be blocked, into a zip file and attach the zip file instead (these may still be blocked though)
  3. It will warn you if your total size of all attachments exceeds 20MB (this limit can be changed in the script) which may cause the send to fail depending on your mail server’s limits

The script can take various other parameters such as -subject, -body and -recipients but these can only be used when calling the script manually from a PowerShell session or another script since using it from explorer just calls the script with a list of file names to attach. However, you can change the default values of these variables in the script so that they will work when you use the send to menu item within explorer. There are comments in the script explaining how to achieve this.

By default, it uses the same subject and body text as the built-in “Email recipient” shortcut but if you don’t like this text, find the declaration of the “$noBody” variable in the script and change it from “$false” to “$true”. Here’s a screenshot of the email generated with that tweak made and with three files selected, an .exe, .txt and .ps1, when the Send To option was invoked:

outlook-send-to-email

Note that the .ps1 file has been morphed into a .txt file and the .exe has been placed into a zip file.

Oh, and my Outlook main window is fully operational whilst you add whatever body text, etc you want to this email before sending it.