Created
March 21, 2017 13:25
-
-
Save jbl0ndie/4c1423f410268fbc6920a740069e82ab to your computer and use it in GitHub Desktop.
Send a file or files as Mail attachments in OS X from Finder, with the subject as the filename
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
on run {input, parameters} | |
(* This script takes a selection of files, appends them to individual emails to a predetermined address | |
using the filename as the subject of the email and then sends it *) | |
set mgPeople to "YourSenderName" | |
set mgAddress to "your.email@address.com" | |
--set mgAddress to "debug.mail@address.com" --debug address | |
set theSender to "debug.mail@address.com" | |
set mgContent to "" | |
set listOfFiles to {} | |
tell application "Finder" | |
set fileList to the selection | |
repeat with mgitem in fileList | |
set currentFileName to (the name of mgitem) | |
copy currentFileName to the end of listOfFiles | |
set label index of mgitem to 7 --new part to tag the file gray | |
tell application "Mail" | |
activate | |
set mgSubject to currentFileName | |
set mgMessage to make new outgoing message with properties {subject:mgSubject, content:mgContent, visible:true, sender:theSender} | |
tell mgMessage | |
make new to recipient with properties {name:mgPeople, address:mgAddress} | |
make new attachment with properties {file name:(mgitem as alias)} at after last paragraph of content | |
end tell | |
save | |
send mgMessage | |
end tell | |
end repeat | |
end tell | |
return input | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#multiSend01
This script takes a selection of files, appends them to individual emails to a predetermined address using the filename as the subject of the email and then sends it. If the script has attempted to send a file, it marks the file with the Gray label.
ToDo:
Move labelling so that it only labels after a successful send operation.