2015-02-24 64 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