Mac Text-to-Speech (TTS) to Email Automation. Use macOS’s built-in say command to generate an AIFF file from a text file.

Testing GSAP Animation

Convert Text to AIFF:

say -v Alex -f input.txt -o output.aiff

Convert AIFF to MP3:

ffmpeg -i output.aiff -codec:a libmp3lame -qscale:a 2 output.mp3

Send MP3 via Email:

(cat output.mp3 | uuencode output.mp3) | mail -s "Your TTS MP3" recipient@example.com

Automation Script:

#!/bin/bash

if [ -z "$1" ] || [ -z "$2" ]; then
  echo "Usage: $0 input.txt recipient@example.com"
  exit 1
fi

TEXTFILE="$1"
RECIPIENT="$2"

# Generate AIFF from text
say -v Alex -f "$TEXTFILE" -o output.aiff

# Convert AIFF to MP3
ffmpeg -i output.aiff -codec:a libmp3lame -qscale:a 2 output.mp3

# Send MP3 via email
(cat output.mp3 | uuencode output.mp3) | mail -s "Your TTS MP3" "$RECIPIENT"

echo "Email sent to $RECIPIENT with the MP3 file."

Automate with Cron:

0 9 * * * /path/to/send_tts.sh /path/to/input.txt recipient@example.com

Postfix Debugging:

ps aux | grep postfix
sudo postfix stop
sudo postfix start
mailq

Now your Mac can read text, convert it to MP3, and send it via email automatically! 🚀