I need an application to read aloud any emails that come into a specific email address

applescriptaudioemailserver.appvoice

I want a sort of audio server which sits in background (running on OS X, not iOS) and whenever an email arrives at a specific address, it reads it aloud. Ideally there would be also an option to filter by a "password" so that spam doesn't get read aloud. I have a home automation system that can send notification emails when stuff happens, and since I already have computers throughout the house, I'd like to have them announce the events rather than buying dedicated audio output client hardware. I'm hoping I can cobble something together with existing software and system tools to enable my Macs to act like audio endpoints (addressed via email).

Any ideas?

Best Answer

As Mark mentioned, AppleScript is the way to go here:

Create a mail rule that runs the following script when an email from your home automation system is received.

using terms from application "Mail"
on perform mail action with messages theselectedMessages
    tell application "Mail"
        repeat with a_message in theselectedMessages
            set the_sender to extract name from sender of a_message
            if (junk mail status of a_message) is not true then
                tell me to say "Mail from " & the_sender
                tell me to say (get content of a_message)
                set read status of a_message to true
            end if
        end repeat
    end tell
end perform mail action with messages
end using terms from