This old thread <http://www.mail-archive.com/[email protected]/msg15747.html> from 2007 discusses a script authored by Justin Beek. Read the caveats from Ben Kennedy. It was posted something like below. It doesn't compile in this form, but with some work it could be a starting point for a script solution if someone wants to fix it.

**Code for "Delete Orphaned attachments" (Doesn't compile)***

global theFolder

tell application "PowerMail"
set attachFolder to attachment folder

set theMessages to current messages
repeat with msg in theMessages
set msgStatus to status of msg

set attachList to attachments of msg
if (count items of attachList) > 0 then
set theID to the ID of msg
set msgAttachFolder to ""
set msgAttachFolder to theID
set msgAttachFolder to msgAttachFolder

tell application "Finder"
if not (exists folder (attachFolder & msgAttachFolder as string)) then

set theFolder to (make new folder at attachFolder with properties {name:(msgAttachFolder as string)})

else
    set theFolder to folder (attachFolder & msgAttachFolder as string)
end if
end tell


repeat with attachIdx from (count items of attachList) to 1 by -1
set attachFile to file of (item attachIdx of attachList)
tell application "Finder"
set newAttachFile to (move attachFile to theFolder without replacing) as
alias
end tell
delete attachment attachIdx of msg
make new attachment at msg with properties {file:(newAttachFile as alias)}
end repeat
end if
end repeat
end tell

Reply via email to