-- Tested on macOS 10.13.6 use AppleScript version "2.4" use scripting additions using terms from application "Mail" on perform mail action with messages messageList in mailboxes mbox for rule aRule -- Save on DesktopPath set desktopPath to (path to desktop) as string tell application "Mail" set selectedMessages to the selection repeat with aMessage in selectedMessages repeat with anAttachment in mail attachments of aMessage set attachmentName to name of anAttachment save anAttachment in file (desktopPath & attachmentName) end repeat end repeat end tell end perform mail action with messages end using terms from