19 lines
657 B
AppleScript
19 lines
657 B
AppleScript
#!/usr/bin/osascript
|
|
on run argv
|
|
if (count of argv) < 2 then
|
|
return "Usage: send_email.scpt <recipient> <subject> <body>"
|
|
end if
|
|
|
|
set recipientAddress to item 1 of argv
|
|
set msgSubject to item 2 of argv
|
|
set msgContent to item 3 of argv
|
|
|
|
tell application "Mail"
|
|
set newMessage to make new outgoing message with properties {subject:msgSubject, content:msgContent, visible:false}
|
|
tell newMessage
|
|
make new to recipient at end of to recipients with properties {address:recipientAddress}
|
|
end tell
|
|
send newMessage
|
|
end tell
|
|
return "Email sent to " & recipientAddress
|
|
end run |