简体   繁体   中英

Applescript to send an email with signature

I am trying to send an email using Apple script. Everything works fine even email is sent to the address used in the script. My problem is I am unable to add the signature in the email content. 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. 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. Your best bet is to just append your signature to theContent .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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