*This message was transferred with a trial version of CommuniGate(tm) Pro*
On Mon, Jun 2, 2003, Ben Kennedy said:

>On 31 5 2003 at 4:36 pm -0400, Max Gossell wrote:
>
>>Is it possible to get the names of incoming attachments written into the
>>end of the body of the message they came with?
>>
>>If not, could this be done via an incoming mailfilter calling for a
>>script? Would somebody with scripting knowledge in such a case be
>>interested in adding such a script?
>
>If this type of thing were available, the very first thing I would do is
>create a filter that would trash any messages containing attachments
>ending in ".pif" or ".exe".
>
>Consider this my re-vote for the ability to filter on attachment names.

Ben,

I've written/modified a script that does what you want.

Here it is. Watch for line breaks. I use it as an incoming mail filter on
every messages.

******
property badAttachment : {"Enclosure", "winmail.dat", ".exe"}

tell application "PowerMail"
        set theMessages to current messages
        repeat with msg in theMessages
                repeat with attach in every attachment of msg
                        repeat with i from 1 to the number of items of 
badAttachment
                                ignoring case
                                        if (name of attach begins with item i 
of badAttachment) or (name of
attach ends with item i of badAttachment) then
                                                tell application "Finder"
                                                        set f to file of attach
                                                        move f to trash
                                                end tell
                                        end if
                                end ignoring
                        end repeat
                end repeat
        end repeat
end tell

*******
-- 
Andy Fragen


Reply via email to