3/30/2018 - 11:41 PM

Mail Send With Attachment On Adding Folder Items

# Mail Send With Attachment On Adding Folder Items

# File > Export
# File format: Script / Script Bundle

# Put a copy of the script in /Library/Scripts/Folder Action Scripts
# or ~/Library/Scripts/Folder Action Scripts

# Use the 'Folder Actions Setupp application, located in /Applications/AppleScript, to:
# Enable folder actions for your image folder.
# Add a script to that folder, choosing the script you created.

on adding folder items to this_folder after receiving addedItems
	repeat with eachItem in addedItems
		set mailFrom to ""
		set mailTo to ""
		set mailToAddress to ""
		set messageSubject to ""
		set messageContent to ""
		tell application "Mail"
			set newmessage to make new outgoing message with properties {subject:messageSubject, content:messageContent & return & return}
			tell newmessage
				set visible to true
				set sender to mailFrom
				make new to recipient with properties {name:mailto, address:mailToAddress}
				make new attachment with properties {file name:eachItem} at after the last paragraph
			end tell
			send newmessage
		end tell
	end repeat
end adding folder items to