【问题标题】:Create mail with attachment using applescript and outlook使用 applescript 和 Outlook 创建带附件的邮件
【发布时间】:2021-03-09 04:41:39
【问题描述】:

我编写了一个小 Applescript 来通过 Outlook 发送带有附件的新消息。但它没有用,我不知道为什么。没有错误或其他东西。该邮件是在 Outlook 的草稿部分中创建的,但缺少附件。有人可以帮帮我吗?

这是脚本:

set mailBody to "<span>TEST</span>" 

set mailAdress to text returned of (display dialog "Mail Adress" default answer "" buttons {"OK"} default button 1) as string 

set whichFile to file
tell application "Finder" to set whichFile to selection
repeat with aFile in whichFile
    tell application "Microsoft Outlook"
        set filename to name of aFile
        set theNewMessage to make new outgoing message with properties {subject:"TEST " & filename, content:mailBody}
        make new recipient at theNewMessage with properties {email address:{address:mailAdress}}
        set theAttachmentFile to aFile as POSIX file
        make new attachment at the end of theNewMessage with properties {file:theAttachmentFile}
        open theNewMessage
    end tell
end repeat 

提前问候和感谢

极速赛车

【问题讨论】:

    标签: outlook applescript


    【解决方案1】:

    这是我一直在使用的替代方法。要使用以下内容,您需要已在您的发件箱中排队等候所需的消息。或者您可以借用下面的几行代码并将其用于您现有的代码中。

    将附件文件设置为“Macintosh HD:Users:Speedster:Documents:Attachment.docx”作为别名 ---用你选择的文件的硬地址替换它

    告诉应用程序“Microsoft Outlook”

    repeat with theMessage in the messages of the outbox
        
        make new attachment at the end of theMessage with properties {file:theAttachmentFile}
        
    end repeat
    

    说完

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-02-07
      • 1970-01-01
      • 2012-01-17
      • 1970-01-01
      • 1970-01-01
      • 2018-11-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多