-1

We are looking to use Mail.app's rules to define certain criteria and, when such criteria is met, to use AppleScript to send a single text message separately to multiple individuals (not as a group text). How can this be accomplished?

This 2006 post on Mac OS X Hints looked to do something similar, but the code referenced is inaccessible due to link rot. This question shows how to send an SMS, but it only sends a single message.

Vincent
  • 2,689
  • 3
  • 24
  • 40

1 Answers1

0

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.

Vincent
  • 2,689
  • 3
  • 24
  • 40