Find attachment name in Entourage

Hi All,

I have done a quick search in this forum but cannot find a definitive answer.

If I know the exact name of an attachment to an entourage mail message, is it possible to search every mail within a particular folder for the sender of the mail who has the named attachment?

So far I have only been able to find any reference to the name of an attachment by reading the source of the mail!?

This what I have so far, reading the source. (Obviously the source of every mail is very large and quite slow to find the name of an attachment within that)

set docName to text returned of (display dialog "Enter name of attachment" default answer "")

tell application "Microsoft Entourage"
	activate
	tell folder "Test"
		try
			set docFrom to (display name of sender of every message whose source contains docName)
		end try
	end tell
end tell

This will sometimes work with one or two messages within my ‘Test’ folder but returns nothing as soon as I ask it to search a much larger folder.

Any help is greatly appreciated.

in-toto…

I have a solution… of sorts!

We have had to export hundreds of emails (almost a thousand, each with attachments) to a shared server so that multiple users have access and to avoid the mail box exceeding its limit.

So with that in mind, I am now able to search for attachment names within these exported emails:-

set docName to text returned of (display dialog "Enter name of attachment" default answer "") --attachment name without extension!
try
	mount volume "afp://username:password@10.20.30.40/Production"
end try
set eMails to every paragraph of (do shell script "ls /Volumes/Production/path/to/emails/ | grep .eml")
repeat with i from 1 to number of items in eMails
	set aTT to ""
	set thisMail to item i of eMails
	
	set aTT to do shell script "tr '\\r' '\\n' </Volumes/Production/path/to/emails/" & quoted form of thisMail & " | grep filename | cut -d'\"' -f2 | cut -d'.' -f1"
	if aTT = docName then
		display dialog "Your attachment is from this email:" & return default answer thisMail buttons {"Cancel"} default button 1
		exit repeat
	end if
end repeat
display dialog "Sorry, your attachment cannot be found : ("

This can be quite slow if it cannot find the attachment name, having to repeat through the (almost) 1000 files (about 2 mins total). But still quicker than opening each mail and searching manually!