(* Running: osascript send-mail.applescript *) on run argv tell application "Mail" set displayForManualSend to false set toVar to item 1 of argv set ccVar to item 2 of argv set subjectVar to item 3 of argv set bodyVar to item 4 of argv set attachVar to item 5 of argv set composeMessage to make new outgoing message tell composeMessage make new to recipient with properties {address:toVar} if length of ccVar > 0 then make new cc recipient with properties {address:ccVar} end if set the subject to subjectVar set the content to bodyVar tell content make new attachment with properties {file name:attachVar} at after last paragraph end tell set visible to displayForManualSend end tell if not displayForManualSend then send composeMessage end if end tell end run