【问题标题】:Using AppleScript to send email with Outlook for Mac no longer works使用 AppleScript 通过 Outlook for Mac 发送电子邮件不再有效
【发布时间】:2020-11-09 14:11:24
【问题描述】:

我有一个 AppleScript,它读取包含地址列表的文本文件,然后在 Outlook 中为每个地址创建一个带有主题的消息,并自动发送电子邮件。这是过去一年左右的工作,但它不再按预期工作。我不确定这是否是最近更新的 Outlook 或我的 Mac OS 造成的。现在发生的是,它只会发送txt文件第一行的地址。

结果窗口中的错误消息是:

error "Can’t get every to recipient of missing value." number -1728 from every «class trcp» of missing value

在事件窗口中:

tell application "Microsoft Outlook"
    read "/Users/******/OneDrive/address.txt" as «class utf8»
end tell
tell current application
    read "/Users/******/OneDrive/address.txt" as «class utf8»
end tell
tell application "Microsoft Outlook"
    set the clipboard to "abuse@*****"
    make new outgoing message with properties {subject:"this is a test"}
    make new recipient with properties {email address:{address:"abuse@****"}} at end of every to recipient of outgoing message id 465175
    send outgoing message id 465175
    set the clipboard to "postmaster@*****"
    make new outgoing message with properties {subject:"this is a test"}
Result:
error "Can’t get every to recipient of missing value." number -1728 from every «class trcp» of missing value

在回复窗口中:

tell application "Microsoft Outlook"
    read "/Users/******/OneDrive/address.txt" as «class utf8»
        --> error number -10004
end tell
tell current application
    read "/Users/******/OneDrive/address.txt" as «class utf8»
        --> "abuse@****
postmaster@****"
end tell
tell application "Microsoft Outlook"
    set the clipboard to "abuse@*****"
    make new outgoing message with properties {subject:"this is a test"}
        --> outgoing message id 465175
    make new recipient with properties {email address:{address:"abuse@****"}} at end of every to recipient of outgoing message id 465175
        --> to recipient 1 of outgoing message id 465175
    send outgoing message id 465175
    set the clipboard to "postmaster@*****"
    make new outgoing message with properties {subject:"this is a test"}
        --> missing value
Result:
error "Can’t get every to recipient of missing value." number -1728 from every «class trcp» of missing value

当我查看 Outlook 的 AppleScript 库时,我注意到我找不到收件人的参考。我还尝试了来自其他在线来源的代码,这些代码被报告为直接在代码中使用单个地址进行工作和测试,但我仍然收到类似的错误“缺失值”

我的 Outlook 版本为 16.39 (20071300) 我的 MacOS 是 10.15.5 版

这是脚本,为了隐私,我在 mac 上标出了用户名; 告诉应用程序“Microsoft Outlook”

set srcFile to ("/Users/******/OneDrive/address.txt") as text

set lns to paragraphs of (read srcFile as «class utf8»)
repeat with ln in lns
    set the clipboard to ln
    set theMessage to make new outgoing message with properties {subject:"this is a test"}
    make new recipient with properties {email address:{address:ln}} at end of to recipients of theMessage
    send theMessage
end repeat

说完

谁能帮忙?

【问题讨论】:

    标签: macos outlook automation applescript office365


    【解决方案1】:

    您好,我在 office 更新 16.39 后遇到了类似的问题,之前的 office 版本 16.38 可以正常工作。

    如果 Outlook mac 关闭,此脚本只能运行一次。在没有再次关闭 Outlook 的情况下进行第二次尝试后,它会产生错误:

    tell application "Microsoft Outlook"
        set theMessage to make new outgoing message with properties {sender:{name:"My Name", address:"demo@demo.com"}, subject:"test", plain text content:"Hallo"}
        
        tell theMessage
            make new to recipient with properties {email address:{address:"test@test.com"}}
        end tell
        send theMessage
    end tell
    

    厄格布尼斯: 错误“缺失值 versteht die Nachricht „make“ nicht。”缺失值中的数字 -1708

    已翻译:“缺失值无法理解 ma​​ke 消息”或 "缺失值不理解 ma​​ke 事件"

    【讨论】:

    • 你好,你能翻译一下错误信息吗?看起来像“缺失值不理解 make 消息”。
    • 是的,谢谢 Yaron,翻译为:“缺失值无法理解 make 消息”或“缺失值无法理解 make 事件”
    • 感谢阿明。我已经能够回滚到 16.38 并且脚本运行良好。如果您需要回滚,请将“应用程序”文件夹中的 Outlook 移至垃圾箱。可以下载16.38officecdn.microsoft.com/pr/C1297A47-86C4-4C1F-97FA-950631F94777/…
    【解决方案2】:

    【讨论】:

    • 塔恩克斯·阿明。我会将其报告为错误。我会关闭这个问题,希望微软能解决它......
    【解决方案3】:

    我可以确认我的发送邮件错误已通过 Outlook 16.41 (20072700) Insider Fast Release 得到修复

    【讨论】:

    • 谢谢阿明。等到正式版再更新到16.41。很高兴听到它对您有用。
    猜你喜欢
    • 2012-12-17
    • 2015-11-13
    • 1970-01-01
    • 2011-09-14
    • 2012-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-01
    相关资源
    最近更新 更多