Penangan kesalahan surat Applescript

0

Saya memiliki skrip untuk mengirim email, tetapi saya ingin mendeteksi jika tidak ada akun email yang disiapkan, dan melakukan hal lain.

Apakah ada cara untuk mendeteksi atau menjebak kondisi ini? Terima kasih.

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

    tell new_message
        make new to recipient with properties {name:"Len", address:"[email protected]"}
    end tell
    delay 7
    send new_message
end tell
Len
sumber

Jawaban:

0

Ini harus dilakukan ...

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