Applescript发送带有签名的电子邮件

时间:2020-04-20 18:54:33

标签: applescript

我正在尝试使用Apple脚本发送电子邮件。即使将电子邮件发送到脚本中使用的地址,也可以正常工作。我的问题是我无法在电子邮件内容中添加签名。这是代码

tell application "Mail"
    set theSubject to "Subject if the testing email" -- the subject
    set theContent to "Body of the email goes here" -- the content
    set theAddress to "test123@gmail.com" -- the receiver address
    set theSignatureName to "Charu" -- the signature name


    set msg to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
    tell msg to make new to recipient at end of every to recipient with properties {address:theAddress}

    set message signature of msg to signature theSignatureName
    send msg
end tell

当我尝试运行此命令时,我收到一条错误警告,提示Mail got an error: AppleEvent handler failed. 我不确定如何设置签名。

预先感谢

1 个答案:

答案 0 :(得分:1)

回顾以前的线程(例如this one),对于High Sierra及更高版本,似乎无法使用const startingTime = Date.now(); const endingTime = startingTime + minutesToAdd * 60 * 1000; 添加签名。最好的选择是将签名附加到message signature