I have a folder action that runs an AppleScript. All it does is just grab the files in a folder and “embeds” the file in an email (i.e. embedding images inline in an email vs as an “attachment”).
I’ve used it successfully for years and through different macOS versions (I’m currently still on Mojave).
But I tried to change the sent-to email address today, and the script stopped working. Now it’ll open a new email. fill in the subject and recipient, but stops there and doesn’t embed the picture and doesn’t send the email.
Also, it still doesn’t work after I revert the change. I had to restore the applescript file from a backup to get it to work again.
Does anyone know why it would do this and how I can fix it?
Here’s the script:
on adding folder items to thisFolder after receiving theseItems
tell application "Mail" to activate
repeat with thisItem in theseItems
tell application "Finder" to set thisName to name of thisItem
tell application "Mail"
set theMessageBody to ""
set theMessage to make new outgoing message with properties {subject:thisName, content:theMessageBody}
tell theMessage
make new to recipient with properties {name:"xyz", address:"xyz@domain.com"}
make new attachment with properties {file name:thisItem} at after the last word of the last paragraph
delay 1
send
end tell
end tell
end repeat
end adding folder items to