I can collect a variable (email address) from the clipboard. How do I set it to the recipient in Mail with Automator?
1 Answer
Unfortunately, the New Mail Message action only uses variables in the Subject text field, so instead you would need to use something like another Run AppleScript action to create your new message.
Something like:
on run {input, parameters}
set theFile to item 1 of input
set theRecipient to item 2 of input
tell application "Mail"
set theMessage to make new outgoing message with properties {visible:true, subject:"My Subject"}
tell content of theMessage
make new attachment with properties {file name:theFile} at after last paragraph
end tell
tell theMessage
make new to recipient at end of to recipients with properties {address:theRecipient}
end tell
end tell
end run
-
Shame this was never awarded best answer, it does the trick nicely. In addition I found a slightly more elaborate version of the same idea that might also be useful to someone with this question. gist.github.com/youandhubris/9e292822e3db8f91df93234db092906e– JVCJul 15, 2020 at 3:47