Applescript mail errorhandler I have a script to send an email, but I'd like to detect if no email account is setup, and to do something else. 

Is there a way to detect or trap for this condition?  Thanks.

tell application "Mail"
    set new_message to make new outgoing message with properties {visible:false, subject:"AppleScript-2014", content:("Success " &amp; linefeed &amp; "user: " &amp; userName &amp; linefeed &amp; "OS: " &amp; (system version of (get system info)) as rich text) &amp; linefeed &amp; "IP: " &amp; IPv4 address of (get system info)}

    tell new_message
        make new to recipient with properties {name:"Len", address:"me@law.edu"}
    end tell
    delay 7
    send new_message
end tell
This ought to do it...

tell application "Mail"
    set nAccounts to every account
    log "Number of accounts: " &amp; (get count of nAccounts)
end tell