Skip to content

Instantly share code, notes, and snippets.

@tempelmann
Created February 15, 2021 14:08
Show Gist options
  • Select an option

  • Save tempelmann/e7083215ca69ea5d64ae91a7da85f296 to your computer and use it in GitHub Desktop.

Select an option

Save tempelmann/e7083215ca69ea5d64ae91a7da85f296 to your computer and use it in GitHub Desktop.
Create a sample email with attachment in AppleScript
tell application "Mail"
set newMessage to make new outgoing message with properties {subject:"theSubject", content:"theBody"}
set theFile to (POSIX file "/etc/hosts") as alias
tell newMessage
make new attachment with properties {file name:theFile} at after the last word of the last paragraph
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment