Email Workflow duplicating saved attachments

I am new to mac and need a little help.

I created a workflow on Automator to extract email attachments from a specified email folder when I execute it. It works like it is supposed to work, but creates duplicates (2 copies) of every attachment. These are the Automator Workflow steps:

Find Mail Mailboxes
Find mailboxes where:
Name contains Attachments

Get Selected Mail Messages
Get selected mail messages

Get Attachments from Mail Messages
Save Attachments in Working

Thanks,

Steven

Can you share the Automator workflow file?

I

Here is a copy of what happens when I run the workflow (I renamed the documents as they all come in with the same name).
Screen Shot 2021-08-03 at 3.14.09 PM

Please note, you have not to this point shared the Automator workflow file. While there is a screenshot, this does not show any options that might be set, make typos difficult, if not impossible to spot, in some cases, and also means that anyone who might want to help and try it out has to rebuild it manually.

Have you tried stepping through your workflow and checking what is in the results at each step?

I think the key first step is to figure out at what point you first get the duplicates. Is it in the find or the get selected?


I don’t use Apple Mail, but my initial suspicion is that the first action is retrieving a set of emails, the second action is retrieving the set of emails selected in the Mail app, and the third action is saving the attachments from two sets of emails that happen to overlap.

How do I share it? I’m new to Mac.

Same as any other file.

Have you stepped through and checked the results at each stage, tried removing the second step, or testing the above theory in any other way? What was the result?