使用 AppleScript 通过 Outlook Mac 发送电子邮件不再有效

Using AppleScript to send email with Outlook for Mac no longer works

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

结果 window 中的错误消息是:

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

在活动中 window:

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

在回复中window:

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

结束讲述

有人能帮忙吗?

您好,自从 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

Ergebnis: 错误“缺失值 versteht die Nachricht ‘make’ nicht。”缺失值中的数字 -1708

translated:“缺失值不理解 make 消息”或 “缺失值不理解 make 事件”

加里,

请提交错误报告。说明在此线程中

https://answers.microsoft.com/en-us/msoffice/forum/all/applescript-outlook-send-mail-stops-working-with/c7e63696-0a71-4e68-9764-f7e7794b92fd

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