Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Can’t make recipient into type rich text, from AppleScript.

Hello. I have wrote the following code in Apple Script, where recipient is the recipient's name, email is the recipient's email address, body is the content of the email, and sub is the subject of the email.

However, Apple Script error reads 'Can’t make recipient into type rich text' and cannot recognize my recipient's email address. Can I get some help, thanking you in advance?


tell application "Microsoft Excel"


set recipient to value of column 1 of row 2 of sheet 1 of active workbook as text


set email to value of column 2 of row 2 of sheet 1 of active workbook as text


set body to value of column 3 of row 2 of sheet 1 of active workbook as text


set sub to value of column 4 of row 2 of sheet 1 of active workbook as text


end tell


tell application "Mail"


activate


set theMessage to make new outgoing message with properties {subject:sub, content:body, visible:true}


tell theMessage


make new to recipient at end of to recipients with properties {name:recipient, address:email}


end tell


actiate


end tell

MacBook Air 13″, macOS 10.14

Posted on Oct 17, 2021 4:39 AM

Reply
Question marked as Best reply

Posted on Oct 17, 2021 9:58 AM

Check out Mail's AppleScript dictionary:



recipient is part of Mail's scripting terminology, which means you can't use it as a variable name. Try something like theRecipient and see if that improves things.


(ps: A bit further down you've got the line "actiate" which will cause problems as it's mis-spelled, and isn't actually necessary as you've already told Mail to activate.)

Similar questions

1 reply
Question marked as Best reply

Oct 17, 2021 9:58 AM in response to vaina176

Check out Mail's AppleScript dictionary:



recipient is part of Mail's scripting terminology, which means you can't use it as a variable name. Try something like theRecipient and see if that improves things.


(ps: A bit further down you've got the line "actiate" which will cause problems as it's mis-spelled, and isn't actually necessary as you've already told Mail to activate.)

Can’t make recipient into type rich text, from AppleScript.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.