简体   繁体   English

Applescript 发送带有签名的 email

[英]Applescript to send an email with signature

I am trying to send an email using Apple script.我正在尝试使用 Apple 脚本发送 email。 Everything works fine even email is sent to the address used in the script.一切正常,即使 email 被发送到脚本中使用的地址。 My problem is I am unable to add the signature in the email content.我的问题是我无法在 email 内容中添加签名。 Here is the code这是代码

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

When I try to run this I receive an error alert that says Mail got an error: AppleEvent handler failed.当我尝试运行此程序时,我收到一条错误警报,提示Mail got an error: AppleEvent handler failed. I am not sure how to set the signature.我不确定如何设置签名。

Thanks in advance提前致谢

Looking back on previous threads (like this one ), it seems that, with High Sierra and above, adding a signature using message signature does not work anymore.回顾以前的线程(比如这个),似乎在 High Sierra 及更高版本中,使用message signature添加签名不再起作用。 Your best bet is to just append your signature to theContent .你最好的选择是只 append 你对theContent的签名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM