Applescript rult to save email attachments into specific folder
I want to save the attachments that come from a specific email address into a folder, automatically.
I set up a rule that filters the emails correctly, and I tried using the script from this thread:
Using applescript to save email attachmen… - Apple Community
but it doesn't work, it doesn't save anything. Debugging it is so difficult! (any tips?)
A copy of the script I am using:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set attachmentsFolder to ((path to home folder as text) & "attacheds") as text
using terms from application "Mail"
on perform mail action with messages these_messages for rule this_rule
tell application "Mail"
repeat with each_message in these_messages
repeat with theAttachment in each_message's mail attachments
set originalName to name of theAttachment
set savePath to attachmentsFolder & ":" & originalName
try
save theAttachment in savePath
end try
end repeat
end repeat
end tell
end perform mail action with messages
end using terms from
MacBook Air 13″, macOS 13.6