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...
when "every person's email 1" list of references, not list of email addresses. actual email address reference "value".
sendto list, have loop on list , add each address 1 @ time in mail.
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
Post a Comment