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"
activate
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
send
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.