Saving a Mail Attachment


I have had a look through the other topics about saving Mail Attachements to a desktop folder but the majority seem to be about renaming the attachments and things.

I have created a rule in mail that says: if FROM = Email Address then Run Apple Script.

All I need the Apple Script to do is save any attachements into a desktop folder. That’s it!

I then get Automator and Filemaker Pro to takeover at that point.

Any help would be great.

Model: iMac
Browser: Chrome
Operating System: Mac OS X (10.6)

Hello i’am using this:

(*Mail attachment save script by Luke Jaeger [url=][/url]

This script will mine a list of Mail messages for attachments and save them to a destination you choose. 

using terms from application "Mail" -----bij mail rule aanzetten
	on perform mail action with messages theMessages for rule theRule -----bij mail rule aanzetten
		--set theOutputFolder to (here's where you tell it the main folder to save in)
		tell application "Finder"
			set theOutputFolder to folder "disk:folder"
		end tell
		tell application "Mail"
			--comment the following line when running this script as a rule function - uncomment it for testing
			--set theMessages to selection --------bij testen aanzetten
			repeat with theMessage in theMessages
				--does the message have attachments? if not, then skip it
				if (every mail attachment of theMessage) ≠ {} then
					--save the attachment to the subfolder
					set theAttachments to (every mail attachment of theMessage)
					repeat with theAttachment in theAttachments
						set thePath to (theOutputFolder as string) & (name of theAttachment)
						--if same named file already exists in subfolder, skip it	
						if not (exists (alias thePath of application "Finder")) then
							save theAttachment in thePath
						end if
					end repeat
					set read status of theMessage to true
				end if
			end repeat
		end tell
	end perform mail action with messages
end using terms from

Hi, thanks for the quick reply.

I’ve just tried implementing this but there seems to be no response. The email comes in as normal and nothing happens with the attachment.

I’ve change the folder path to the one I want, is there anything else I need to change?


did you make a rule in mail?

have a look at the path of “theOutputFolder”
could be something like this; “Macintosh HD:Users:nameofuser:Desktop:nameofdir”?

perhaps you could contact Luke Jaeger, he created the script.



Hi, almost got it working now!

It did work a few times but now whenever an email comes in to mail that complies with the rule set, mail just freezes and I have to force quit.

I’ve run the Filemaker script on it’s own and it works fine so I’m not sure what’s causing this?