Skip to content

Instantly share code, notes, and snippets.

@tylerpeterson
Created September 21, 2015 21:18
Show Gist options
  • Save tylerpeterson/c3aa65806bf141b04e25 to your computer and use it in GitHub Desktop.
Save tylerpeterson/c3aa65806bf141b04e25 to your computer and use it in GitHub Desktop.
Making a new email in Outlook 365 via AppleScript
set the_file_name to "test.txt"
set the_file to alias ((path to desktop as text) & the_file_name)
tell application "Microsoft Outlook"
set new_message to make new outgoing message at mail folder "Cabinet" with properties ¬
{subject:"Test Subject", content:"Here is some test content. See attached: " & the_file_name}
make new attachment at end of new_message with properties {file:the_file}
make new recipient at new_message with properties {type:to recipient type, email address:{name:"Tyler Peterson", address:"[email protected]"}}
make new recipient at beginning of new_message with properties {type:cc recipient type, email address:{name:"CC Tyler", address:"[email protected]"}}
make new recipient at beginning of new_message with properties {type:bcc recipient type, email address:{name:"BCC Tyler", address:"[email protected]"}}
end tell
@mrxinu
Copy link

mrxinu commented Jun 11, 2022

Good one, thanks!

@darkwebdev
Copy link

👍

@libor13
Copy link

libor13 commented Sep 12, 2023

Is possible to set HTML content?

@LukasWallrich
Copy link

Great idea - but I can't get this to work. When I change Cabinet to Drafts, it runs - but nothing seems to happen?

@anaderix
Copy link

Same here. it runs, but nothing happens (

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment