Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Find the email a saved attachment was sent with Apps
If you save an attachment from an e-mail message, and later need to find exactly which message it came from but cannot remember which it was, it can be done with a little bit of work.

First, select the file in the Finder and open its Info window by pressing Command-I. In the More Info section, you should see the file's "Where from" information. This will list the sender's name and address and the subject line of the message that the file was originally attached to. You can first use this information to try searching in Mail for the message. Many times, that's all you'll need to do.

However, if that doesn't cut it for you - for example, you have multiple revisions of a file that were sent back and forth in a series of messages, and you need to determine which came from which - there is one more bit of metadata in the "Where from" information that can solve that for you.

Copy the part of the "Where from" information that looks something like this:
Switch to Safari and paste that into the address field. Mail will activate and show you the message (assuming it still exists).

[kirkmc adds: Nice hint, but it doesn't always work for me. The Where from information is often truncated, and I can't copy the entire path as shown above. However, there's another way to do this: in Terminal, type mdls, press the spacebar, then drag the file to the Terminal window and press Return. This displays all the Spotlight metadata for the file. You'll find the Where from section near the bottom, and you can copy it in its entirety there, then paste it into Safari.

And I'm thinking that someone should be able to create an AppleScript that parses this information with a bit of grep, then sends it to Safari, hence making it possible to create a droplet which will do the trick. Anyone?]
  • Currently 2.50 / 5
  You rated: 2 / 5 (8 votes cast)

Find the email a saved attachment was sent with | 3 comments | Create New Account
Click here to return to the 'Find the email a saved attachment was sent with ' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Find the email a saved attachment was sent with
Authored by: barijaona on Jan 25, '13 09:39:30AM

Here is a quickly baked Applescript :

tell application "Finder"
set sel to the selection as text
set thePath to POSIX path of sel
end tell

set theId to do shell script "mdls \"" & thePath & "\" | grep message\\:"
do shell script "open " & theId

[ Reply to This | # ]
Find the email a saved attachment was sent with
Authored by: Sesquipedalian on Jan 25, '13 10:43:53AM
No sooner said than done, kirkmc. This can be saved as an application in Script Editor, or as a script in ~/Library/Scripts/Applications/Finder (make the folder as necessary). Some trivial adaptation could also turn it into a service using Automator's Run AppleScript action (I'll leave that as an exercise for the reader).
on open thefiles
	repeat with thisfile in thefiles
	end repeat
end open

on run
		tell application "Finder" to set thefiles to its selection
		if result is {} then error
	on error
		set thefiles to choose file with multiple selections allowed
	end try
	repeat with thisfile in thefiles
		mainscript(thisfile as alias)
	end repeat
end run

on mainscript(thefile)
	set filepath to POSIX path of thefile
	do shell script "open $(mdls " & quoted form of filepath & " | grep 'message:' | cut -d\\\" -f2)"
end mainscript

[ Reply to This | # ]
Find the email a saved attachment was sent with
Authored by: PantherMan on Jan 25, '13 08:23:21PM

The script works perfectly, Thank You. Its one of those things that you don't realize are invaluable until you very desperately need it. Its so useful that I think it should be built into OS X.

World Peace Through Better Computing
The Macintosh OS

[ Reply to This | # ]