You'll first need to set up iMessage in Messages so you can send texts from your Mac.
Then, open Script Editor, create a new script, and paste in the following code:
property recipients : {"+1 (999) 999-9999", "email@icloud.com"}
repeat with recipient in recipients
tell application "Messages"
send "your message here" to participant recipient
end tell
end repeat
In recipients
, add as many phone numbers or emails that can receive texts as needed between the curly brackets, each in quotations and separated from the previous one by a comma, and edit your message here
to the message you want to send.
Save the script in ~/Library/Application Scripts/com.apple.mail
, as explained here.
Create your mail rule and, under Perform the following actions:, include a Run AppleScript action and select the saved script. Once the rule is saved, you're all done.
Upon receiving an email that meets the criteria of the rule you set up, the script will loop through each phone number or email in recipients
and send them the specified message. The script has no problem sending a message to a contact you've never messaged before.