Edit Automator workflow to work from within Apple Mail

Hi everyone,


I created an Automator workflow which adds a watermark to PDF files. Right now this works fine by right-clicking the PDF in Finder and selecting my workflow under Quick Actions.


I would like to further optimise this, because the PDFs that need this watermark are coming in as an E-Mail attachment. Right now I have to save the attachment and run the workflow in Finder. I would like to run it directly from within Mail.


The last action in my workflow is to create a new message with the watermarked PDF attachment anyway so it would be nice to do everything without leaving Mail.


The current workflow starts with the Watermark PDF Documents action which got automatically added the Workflow receives input automatically from every application when I chose the Quick Action workflow type in Automator. I also had it working as a standalone app where you could drag & drop PDFs onto the app icon. But I can’t figure out a way to do it directly from within Apple Mail…



Posted on Jun 17, 2025 07:50 AM

Reply
Question marked as Top-ranking reply

Posted on Jun 17, 2025 01:44 PM

Change your workflow to add the following Actions at the beginning:


• Get Selected Mail Messages - This gets the selected message(s) in Mail.app

• Get Attachments from Mail Messages - This gets the attachments associated with the selected message(s)


The output of Get Attachments from Mail Messages can be passed directly into the Watermark PDF Documents action. This will fail silently if there are no PDFs passed in, so there's no extra work involved.

6 replies
Question marked as Top-ranking reply

Jun 17, 2025 01:44 PM in response to Björn Herrmann

Change your workflow to add the following Actions at the beginning:


• Get Selected Mail Messages - This gets the selected message(s) in Mail.app

• Get Attachments from Mail Messages - This gets the attachments associated with the selected message(s)


The output of Get Attachments from Mail Messages can be passed directly into the Watermark PDF Documents action. This will fail silently if there are no PDFs passed in, so there's no extra work involved.

Jun 18, 2025 02:10 AM in response to Camelot

Thank you, I missed this because the german translation of these actions is kind of misleading. It works fine now and I added a keyboard shortcut as well to run it from within Mail.


The Get Attachments action is saving the files in my Downloads folder. So after running this a couple of times it gets quite crowded in there. Any way I can skip saving the PDFs there at all or at least move them to trash after the workflow has finished?

Jun 18, 2025 10:43 AM in response to Björn Herrmann

> The Get Attachments action is saving the files in my Downloads folder. So after running this a couple of times it gets quite crowded in there. Any way I can skip saving the PDFs there at all or at least move them to trash after the workflow has finished?


I don't think there's an option that doesn't involve saving to disk.


However, you can edit the Get Attachments from Mail Messages action to save the files anywhere you like. You could create a separate folder for these temporary items, and just add an action at the end to delete these files (safer than deleting all files in the trash since there may be other content there you want to retain).

Jun 18, 2025 03:25 AM in response to Björn Herrmann

Quick follow-up: I added a shell script containing


trash ~/Downloads/*


to the end of my workflow. The trash command was new to me and it seems it was introduced with macOS Sequoia. Works fine and better than using rm in case you want to recover something from trash.


Still I’d be interested in a way to skip saving the PDFs to Downloads in the first place.

Jun 18, 2025 12:40 PM in response to Camelot

Thanks again. I’ll think about changing the location, but right now it’s not too dangerous. The trash command above just puts everything from ~/Downloads to the Trash without emptying it. So I can retrieve stuff in case I need to.


Doesn't really conflict with my workflow too since I only keep recently downloaded files in there which I file in their respective folders quite frequently. And the PDFs from this Automator workflow are only copies from the originals I received via Mail.


Well, problem solved. Thank you!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Edit Automator workflow to work from within Apple Mail

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.