Apple mail

From malue-ai/dazee-small · View interactive version

Apple mail is an AI agent skill from the GitHub repository malue-ai/dazee-small. Search, read, and compose emails in Apple Mail on macOS via AppleScript/JXA.

How to use this skill

Skill file

Apple 邮件

通过 AppleScript/JXA 操作 macOS 内置的 Apple Mail 应用,支持搜索、阅读、撰写邮件。

使用场景

执行方式

获取未读邮件

osascript -e '
tell application "Mail"
    set unreadMessages to (messages of inbox whose read status is false)
    set output to ""
    repeat with msg in (items 1 thru (min of {10, count of unreadMessages}) of unreadMessages)
        set output to output & "From: " & (sender of msg) & linefeed
        set output to output & "Subject: " & (subject of msg) & linefeed
        set output to output & "Date: " & (date received of msg) & linefeed
        set output to output & "---" & linefeed
    end repeat
    return output
end tell'

读取邮件内容

osascript -e '
tell application "Mail"
    set msgs to (messages of inbox whose subject contains "关键词")
    if (count of msgs) > 0 then
        set msg to item 1 of msgs
        return "From: " & (sender of msg) & linefeed & ¬
               "Subject: " & (subject of msg) & linefeed & ¬
               "Date: " & (date received of msg) & linefeed & ¬
               "Content: " & linefeed & (content of msg)
    end if
end tell'

搜索邮件

osascript -e '
tell application "Mail"
    set results to (messages of inbox whose subject contains "搜索词" or sender contains "搜索词")
    set output to ""
    repeat with msg in (items 1 thru (min of {20, count of results}) of results)
        set output to output & (sender of msg) & " | " & (subject of msg) & " | " & (date received of msg) & linefeed
    end repeat
    return output
end tell'

创建新邮件

osascript -e '
tell application "Mail"
    set newMessage to make new outgoing message with properties ¬
        {subject:"邮件主题", content:"邮件正文", visible:true}
    tell newMessage
        make new to recipient at end of to recipients ¬
            with properties {address:"recipient@example.com"}
    end tell
    -- 不自动发送,让用户确认
end tell'

安全规则

输出规范

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.