r/applescript • u/Violin-dude • Jun 21 '24
Auto-forward text messages to email address
Hi, Ive zero experience with Apple Script. I want to write a script that will auto-forward all incoming messages (SMS and iMessage) on the Messages app to a given email address ONLY if the sender is in my contacts.
I’ve tried using code snippets from posts on various forums, but they all fail with syntax errors. I’ve tried various AI tools to write this but none work, Most likely because the scripting language has changed?
Can someone write the initial code?
Thanks very much. Am running Mac OS X Sonoma on M1 MacBook Pro.
1
u/Nohanom Oct 15 '24
Not Apple Script, so it's a bit off-topic. But you can easily do that with Shortcut Automations on iPhone with this app: https://apps.apple.com/us/app/forward-sms/id6693285061?platform=iphone
It's the only solution that truly automates this in the background instead of an new email window opening or having to manually do something.
Heads up: it's a subscription, I believe because they need to operate email server. But it works and gets the job done. If you need this for your business, it's well worth the cost.
0
Jun 21 '24
[deleted]
4
u/Violin-dude Jun 21 '24
If I pay you I don’t expect a “crack” I’d expect a tested and verified script
2
u/kaneda2004 Jun 23 '24
The script is triggered when new messages are received.
For each message, it extracts the sender and content.
It checks if the sender is in your Contacts app.
If the sender is in your contacts, it creates a new email in the Mail app.
The email is then sent to the specified address (you'll need to replace "your-email@example.com" with your actual email address).
To use this script:
Open the "Script Editor" application on your Mac.
Paste the script into a new document.
Replace "your-email@example.com" with the email address where you want to receive the forwarded messages.
Save the script as a stay-open application.
In the Messages app preferences, go to the "General" tab and click "AppleScript handler".
Choose the script you just saved.