Created
September 7, 2015 13:45
-
-
Save adidonato/8c9b832d65e4181a28af to your computer and use it in GitHub Desktop.
Mac osx: Send files via email using Mail.app from the terminal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
################################################################### | |
# usage: ./compose_apple_mail.sh 'address' 'Subject' path_to_file # | |
# no arguments are compulsory # | |
################################################################### | |
echo "tell application \"Mail\" | |
activate | |
set MyEmail to make new outgoing message with properties {visible:true, subject:\"$2\", content:\"I am emailing you the following file: $3 \n\n \"} | |
tell MyEmail | |
make new to recipient at end of to recipients with properties {address:\"$1\"} | |
make new attachment with properties {file name:((\"$3\" as POSIX file) as alias)} | |
end tell | |
end tell | |
" | osascript |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment