【问题标题】:Edit the subject of a forwarded message using Applescript - encountering error when editing subject line使用 Applescript 编辑转发邮件的主题 - 编辑主题行时遇到错误
【发布时间】:2016-04-19 19:20:06
【问题描述】:

我一直在尝试编写一些 Applescript 来转发消息并编辑主题。目前我正在处理收件人和主题行的转发和填充。

当我运行它时,它给了我错误:

"Mail got an error: Can't set subject of item to any."

代码如下:

tell application "Mail"
    set theSelection to selection
    set theForwardedMessage to forward (item 1 of theSelection) with opening window
    tell theForwardedMessage
        make new to recipient with properties {address:"address@blahblah.com"}
        set subject to "blahblahblah"
    end tell
end tell

我不明白为什么它告诉我它不能编辑主题行。有什么指点吗?

【问题讨论】:

    标签: email applescript osx-elcapitan


    【解决方案1】:

    我希望这会有所帮助,但我不完全理解你的脚本和问题。

    set recipientName to "ZWEKKERBOY"
    set recipientAddress to "john@doe.com"
    set theSubject to "Subject here"
    set theContent to "Content"
    
    --Mail Tell Block
    tell application "Mail"
    
    --Create the message
    set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
    
        --Set a recipient
    tell theMessage
            make new to recipient with properties {name:recipientName, address:recipientAddress}
    
        --Send the Message
        send
    
    end tell
    end tell
    

    --感谢制造商!

    你可以改变

    set theSubject to "Subject here"
    

    行

    到

    set theSubject to subject
    -- that's "blahblahblah"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-13
      • 2019-08-24
      • 1970-01-01
      • 1970-01-01
      • 2023-02-20
      • 2010-12-16
      相关资源
      最近更新 更多