#!/usr/bin/osascript

on run argv
	set filepath to item 1 of argv

	set old_delims to AppleScript's text item delimiters
	set AppleScript's text item delimiters to {"/"}
	set path_items to text items of (filepath as text)
	set AppleScript's text item delimiters to old_delims

	set filename to last item of path_items

	tell application "Mail"
		set new_msg to make new outgoing message with properties {subject:filename, content:"" & return & return}
		
		tell new_msg
			set visible to true
			tell content
				make new attachment with properties {file name:filepath} at after the last paragraph
			end tell
		end tell
		
		activate
	end tell
end
