Save email attachments to Downloads folder

Hello everyone,

I’ve looked around for a solution, but the ones I found don’t quite do what I need (or at least, I wasn’t able to use them). Can someone help me write an Apple Script to automatically save PDF email attachments to the Downloads folder?

Basically, I want to use Apple Mail’s rules to activate the script whenever an email with a PDF attached enters any of my Inboxs.

Is this doable?

Thank you so much!


Type “save mail attachments” in the Search of this site.

Hi @KniazidisR
I did, but none of them seems to do what I need. They seem to be for specific types of files, or folders other than the downloads’ folder, and my Apple Scripts knowledge is very limited, so I wouldn’t be able to customize them.
Thank you!


It sounds like you located scripts that do exactly what you need, but for .jpg files instead of .pdf files or something, saving them to, say, the Documents folder instead of the Downloads folder.

The description of the scripts you found and your explanation of what you wish to achieve are literally identical, up to string value constants. This is good news, as it sounds like no actual AppleScript-specific code needs to be changed, only those string values.

If you feel too confused by this, what you can do is locate the script you need customised, paste a link to it or the script text itself here, and someone (might be me, might not be) will post a customised version.

If you can, try and choose a script that is written for the same version of macOS that you’re currently running, as that can (and probably will) make a difference. Otherwise, go for the nearest version of macOS that precedes your version of macOS.

You’re right, the issue was with the macOS version (at least, it appears so). After reading your message, I looked around, and found a way to make one of the scripts work for me :grinning:
In the meantime, I also found another solution, that involves Hazel, which I already use, and the folder where Mail saves all its attachments by default (which I wasn’t aware of). This makes it really easy to process all incoming attachments.
So now I have two solutions. Will need to explore which one works best.
Thank you so much!

Well done! :muscle:t2:⁠⁠⁠⁠⁠