applescript - I need to convert an email address to a recipient -


need convert email address contacts recipient in mail.

tell application "contacts"     set sendto every person's email 1 end tell  tell application "mail"     set mesg make new outgoing message     set recipient of mesg sendto -- need convert here.     set subject of mesg "a title"     set content of mesg "a body"     send mesg end tell 

you've got several problems in code...

  1. when "every person's email 1" list of references, not list of email addresses. actual email address reference "value".

  2. sendto list, have loop on list , add each address 1 @ time in mail.

  3. there's different kinds of recipients. need use "to recipient".

try this:

tell application "contacts"     set sendtolist value of every person's email 1 end tell  set emailsender "me@me.com" set thesubject "the subject of mail" set thecontent "message body" tell application "mail"     set mesg make new outgoing message properties {sender:emailsender, subject:thesubject, content:thecontent, visible:true}     tell mesg         repeat 1 count of sendtolist             set thisemail item of sendtolist             if thisemail not missing value                 make new recipient @ end of recipients properties {address:thisemail}             end if         end repeat         --send     end tell end tell 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -