Is there a shell script to send notifications on mail events? I've never written an apple script before so I am wondering if there's a way to write a script that continuously (maybe at intervals of 10 minutes) checks my inbox and sends a notification on my mac if there's a new email in inbox (microsoft exchange). (That being said, I also don't mind a python script, anything that gives this functionality is welcome)

Is there a shell of this so I could start on what's hopefully an easy scripting problem?
Web mail isn't going to be a basic scripting topic, so since you're new you'll need to have a mail client set up.

Assuming that's the case, heres a script that checks for new mail by comparing dates of latest messages. It checks every 10min and will send a notification if there's new mail.


Open Script Editor
Copy and Paste the script
Go to File>Export
File Format = Application
Make sure Stay open after after script handler is checked
Open the application




tell application "Mail"
set new1 to date received of (first message of inbox)
repeat
    check for new mail
    delay 5 --wait until all new messages are in the box 
    set new2 to date received of (first message of inbox)
    if new2 is not equal to new1 then
        display notification "You've got Mail." with title "New Mail"
    end if

    ## For the AOL Effect ##

    # do shell script "say \"You've got mail\""
    set new1 to new2
    delay 600 -- 10 min in seconds 
end repeat
end tell