【问题标题】:How to use applescript to tell Mail to keep a copy of sent message如何使用applescript告诉Mail保留已发送邮件的副本
【发布时间】:2015-01-30 06:18:04
【问题描述】:

我使用 AppleScript 并且可以毫无问题地发送消息,但是“已发送”框没有收到我发送的内容的副本。但是,如果我使用邮件应用程序发送消息,“已发送”框会获得我发送的内容的副本。所以我猜我的 AppleScript 可能会错过一个命令,告诉 Mail 保留已发送消息的副本。我错过了什么命令?谢谢。

tell application "Mail"                                                         
    set theNewMessage to make new outgoing message with properties {subject:theSubject, content:theBody & return & return, visible:true}                       
    tell theNewMessage                                                          
        set visibile to false                                                   
        set sender to theSender                                                 
        make new to recipient at end of to recipients with properties {address:theAddress}                                                                     
        make new attachment with properties {file name:theAttachment} at after the last paragraph                                                              
        send                                                                    
        delay 5                                                                 
    end tell                                                                    
end tell   

【问题讨论】:

    标签: email applescript


    【解决方案1】:

    发送消息后尝试添加此内容...

    set accountReference to first account whose name = "my account name"
    synchronize with accountReference
    

    【讨论】:

      【解决方案2】:

      我认为您没有遗漏任何命令。我将您的脚本复制到我的 iMac 上的脚本编辑器,为 theSubject、theBody、theAddress、theSender 和 theAttachment 设置值,然后运行它。它 (a) 成功发送了消息,并且 (b) 我能够在我的已发送邮箱中查看它发送的消息。

      我对已知发件人和随机 example.com 发件人都进行了尝试。在这两种情况下,它都保存在默认的“发送”框中。

      所以问题很可能出在其他地方。确保您当前用于 theSender 的值映射到 Mail 中保存已发送消息的帐户。 (如果是 IMAP 帐户,它可能会将发送的消息保存在服务器上,服务器行为可能会影响您看到的内容。)

      如果这不起作用,请为脚本中除 theAddress 之外的所有变量设置一些测试值(使用 example.com 作为 theSender),并将这些(除了 theAddress)包含在您的问题中。 (如果您也可以使用 example.com 作为地址,那么就这样做,但有些服务器会立即拒绝该消息,这使得测试这种特殊情况毫无价值。)

      请注意,您有一个错误不会改变此行为;您将“可见”拼写为“可见”。但是,我尝试了两种方式,在这两种情况下,传出消息都存储在适当的“发送”框中。

      【讨论】:

      • 非常感谢。首先是为了抓住拼写错误。其次是潜在的解决方案。我将查看 IMAP 设置、服务器设置,并尝试您的方法。很高兴得到您的确认,我的命令很适合保存副本。再次感谢。
      猜你喜欢
      • 2014-11-05
      • 2011-09-19
      • 1970-01-01
      • 2012-07-10
      • 1970-01-01
      • 1970-01-01
      • 2012-03-17
      • 2016-11-29
      • 2021-03-24
      相关资源
      最近更新 更多