I run a small company and recieve invoices by mail as pdf attachments. I use Mail. I want to be able to forward these mails with invoice attached to two prespecified email adresses and a few prespecified sentences in the body. I would have loved to just press a keyboard combination for the whole action to take place, instead of having to push "Forward", type in the addresses and body text and then push "Send".

I am new to Automator and AppleScript, have no coding experience, but I have tried different solutions including Automator, Rules within Mail and Applescript, but with no luck. Is there a way to do this task easy by simply using a keybord combination or a button in Mail?

  • It’s a non Apple solution, but doesn’t your email provider have server side rules to filter email on given criteria? I use Outlook.com and can forward an email in the exact manner you describe with a single line of “non-code” rule “language.”
    – Allan
    Mar 16, 2020 at 20:01

1 Answer 1


I came up with a solution that I think may be a good option for you. This following AppleScript code is a folder action that will ultimately be attached to a folder of your choice (the folder in which you will download the PDF invoice that was sent to you in the email). Basically, the concept is, when you save the PDF invoice in your email to the specified folder, it will trigger the folder action which will take that PDF file and use it as an attachment to the new outgoing emails which will be sent to the email addresses that you set in the AppleScript code. In Script Editor.app, paste this following AppleScript code into a new document. Assuming your forward to email addresses will always be the same and the subject and body content text will also always be the same, you will only need to change the variable values for forwardToRecipients , theSubject , and theContent one time only. Anyway once you change those values to your liking, save that AppleScript document as a .scpt file and name it something like “Forward Email Attachment.scpt”… to your /Users/YOUR_USERNAME/Library/Workflows/Applications/Folder Actions folder. Once it is saved to that location it will always be available to choose in your Folder Actions Setup dialogue. (which can easily be accessed by right clicking on any folder in Finder app then selecting Services/Folder Actions Setup…)

on adding folder items to theFolder after receiving theNewItem
    -- Insert Valid Forwarding Email Address 
    set forwardToRecipients to {"[email protected]", "[email protected]"}
    -- Insert Your Desired Subject Text
    set theSubject to "Subject Text Blah Blah Blah"
    -- Insert Desired Body Content Text
    set theContent to "Text Text" & linefeed & "Text Text And More Text" & linefeed & linefeed

    set mailAttachment to POSIX path of theNewItem

    tell application "Mail"
        repeat with i from 1 to count of forwardToRecipients
            set thisItem to item i of forwardToRecipients
            tell (make new outgoing message)
                set subject to theSubject
                set content to theContent
                make new to recipient at end of to recipients with properties {address:thisItem}
                make new attachment with properties {file name:(POSIX file mailAttachment)} at after last paragraph
                delay 5
            end tell
        end repeat
    end tell
end adding folder items to

After that is all set up and ready to go, all you need to do now is attach the folder action to the folder where are you will be downloading the PDF invoices from your emails to.

enter image description here

enter image description here

  • Thank you! I tried your suggestion, but nothing is happening when I move an attachment to the folder. Should the mail be sent automatically right after I save the attachment in the folder? It might be problems with the location of the script file. I was not able to find the Folder Actions where you described. On my computer the folder was placed in Macintosh HD⁩/⁨Library/⁨Scripts⁩. Could that be the problem? I have one folder named "Folder Actions" and another named "Folder Action Scripts". I tried to save the script both places with no luck.
    – Arnie
    Mar 9, 2020 at 22:05
  • @Arnie So sorry about that. I just tested the code that I posted and found that the line set mailAttachment to POSIX path of theNewItems should have been set mailAttachment to POSIX path of theNewItem . Please try now with the updated code and let me know if it works for you please.
    – wch1zpink
    Mar 16, 2020 at 19:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .