set destinatarios to {"email1@gmail.com", "email2@gmail.com", "email3@gmail.com"}
set direcciones_emails to (choose from list destinatarios with prompt "Elige los destinatarios:" with multiple selections allowed) as list
tell application "Mail"
set theNewMessage to make new outgoing message with properties {subject:"Subject text", content:"Content text", visible:true}
tell theNewMessage
make new to recipient at end of to recipients with properties {address: direcciones_emails}
send
end tell
end tell
I need add selected items from list “destinatarios” and put them to address, to send mail to those email directions how i can write it?
direcciones_emails is a list, so I think you have to loop through the list to add each email address to the sender.
set destinatarios to {"email1@gmail.com", "email2@gmail.com", "email3@gmail.com"}
set direcciones_emails to (choose from list destinatarios with prompt "Elige los destinatarios:" with multiple selections allowed) as list
tell application "Mail"
set theNewMessage to make new outgoing message with properties {subject:"Subject text", content:"Content text", visible:true}
tell theNewMessage
repeat with anAddress in direcciones_emails
make new to recipient at end of to recipients with properties {address: anAddress}
end repeat
send
end tell
end tell