Attach Files to a new Outlook 2016 message in Mac OS (High) Sierra or Mojave
Step by step instructions for using Applescript on Mac OS X High Sierra and Mojave to easily attach files to a new e-mail message in Outlook 2016 from a Finder window.
Attaching files to e-mail
I often want to attach files from Finder to a new e-mail, and I use Outlook from Office 365 on Mac OS Sierra (and now updated for MacOS Mojave).
I know you can drag the selected file(s) to the Outlook icon in the Dock. But this is often an extra action. I just want to right click, and "Share", or similar.
Apparently Outlook 2016 (Office 365) does not ship anymore with the handy Automater scripts that used to accompany Outlook.
Using Applescript and Automator
After searching around the internet for different options, I found out that using Applescript together with Automator is the easiest way to do this.
In Automator:
- create a new:
- Service (
File->new->Service
) under MacOS Sierra - Quick Action (
File->new->Quick Action
) under MacOS Mojave
- Service (
- At the top right, make sure you select that the services receives selected 'Files or folders' in 'Finder.App'.
- Then from the left Action menu, search for
Run Applescript
and drag that to the window on the right. - For the script insert:
on run {input, parameters}
set SelectedItems to input
tell application "Microsoft Outlook"
set newMessage to make new outgoing message
tell newMessage
repeat with aFile in SelectedItems
make new attachment with properties {file:aFile}
end repeat
end tell
open newMessage
get newMessage
activate
end tell
return input
end run
- Then save the service (
File->Save
). The name of the file will be the name in the Finder right-click menu! (I used: 'Attach to Outlook e-mail.workflow')
Attach menu option available
Now when you go to Finder, select one or more files, and then right-click, you will see 'Attach to Outlook e-mail' at the bottom of the menu! Woohoo!
Breakdown
So what does the Applescript do? Let's break it down.
- When the service is called (from Finder), save the selected files to the
SelectedItems
variable.
on run {input, parameters}
set SelectedItems to input
- Then let Outlook create a new e-mail message in
newMessage
tell application "Microsoft Outlook"
set newMessage to make new outgoing message
- And add all files from
SelectedItems
as attachments to the e-mail
tell newMessage
repeat with aFile in SelectedItems
make new attachment with properties {file:aFile}
end repeat
end tell
- Don't forget to open the new message (otherwise it stays in 'Drafts')
open newMessage
get newMessage
- And show Outlook, otherwise it might happen on a different Desktop.
activate
end tell
return input
end run