Loading...
Loading...
Read email via Apple Mail.app and AppleScript. Use when asked to check, search, or read emails. READ ONLY — no sending or modifying emails.
npx skill4agent add eins78/skills apple-maildocs/email-accounts.mdosascript -e 'tell application "Mail" to get name of every account'osascript -e 'tell application "Mail" to count (messages of inbox whose read status is false)'osascript -e 'tell application "Mail"
set recentMsgs to messages 1 thru 10 of inbox
repeat with msg in recentMsgs
set msgInfo to "From: " & (sender of msg) & " | Subject: " & (subject of msg) & " | Date: " & (date sent of msg)
log msgInfo
end repeat
end tell'osascript -e 'tell application "Mail"
set msg to message 1 of inbox
return "From: " & (sender of msg) & "\nSubject: " & (subject of msg) & "\nDate: " & (date sent of msg) & "\n\n" & (content of msg)
end tell'osascript -e 'tell application "Mail"
set foundMsgs to (messages of inbox whose subject contains "keyword")
count foundMsgs
end tell'osascript -e 'tell application "Mail"
set foundMsgs to (messages of inbox whose subject contains "keyword")
if (count foundMsgs) > 0 then
set msg to item 1 of foundMsgs
return "From: " & (sender of msg) & "\nSubject: " & (subject of msg) & "\nDate: " & (date sent of msg) & "\n\n" & (content of msg)
else
return "No messages found"
end if
end tell'osascript -e 'tell application "Mail"
set foundMsgs to (messages of every mailbox of every account whose subject contains "keyword")
-- Note: this can be slow across many accounts
end tell'osascript -e 'tell application "Mail" to get name of every mailbox of account "Gmail"'messages of inboxcontent of msgsource of msgwhosewith timeout of 60 secondshttps://github.com/eins78/skillshttps://github.com/eins78/skills