2015-02-24 40 views
0

我正在写一个applescript,它作为一个电子邮件合并,从数字文件(名称,电子邮件地址,许可证代码,促销代码)中获取信息并在邮件中生成电子邮件。插入基本动态内容后,会发生一些文本格式(使文本变为粗体和红色或蓝色)。该代码有效,但一旦编辑了一些内容,消息签名就会消失。签名在那里,但几秒钟后消失。Applescript:古怪与邮件签名

但是,如果我在行上设置了断点(使用脚本调试器)消息签名被设置,它就可以正常工作。下面是一个示例代码,说明了这一点:

tell application "Mail" 
     set theMsg to (make new outgoing message with properties {subject:"Test", content:"Wahoo", visible:false}) 
     tell theMsg 
      make new to recipient with properties {name:"Josh Booth", address:"[email protected]"} 
      set character 1 to "Y" 
      set color of character 1 to {60000, 1, 1} 
     end tell 
     set theMsg's message signature to signature "JB_SocialMedia" 
     log "Fin" 
    end tell 

此外,即使可见属性设置为false,它仍然显示。在OS X Yosemite上运行,但这个问题也发生在小牛队。

有什么想法?

回答

0

用消息创建签名。

tell application "Mail" 
    set theMsg to (make new outgoing message with properties {subject:"Test", content:"Wahoo", visible:false, message signature:signature "JB_SocialMedia"}) 
    tell theMsg 
     make new to recipient with properties {name:"Josh Booth", address:"[email protected]"} 
     set character 1 to "Y" 
     set color of character 1 to {60000, 1, 1} 
    end tell 
    log "Fin" 
end tell