Maybe its a bug but display name won’t set, the address works fine, just not the recipients name.
If its a bug or someone can see a problem with my code please let me know.
code example: the variables are strings
make new to recipient at beginning of to recipients with properties {name:customer, address:customer_email}
new_Mail("new mail", "Hello, this is my message", "me@mydomain.com", "John Doe", "john@doe.com", ((path to desktop as Unicode text) & "test.txt"), "", false)
on new_Mail(theSubject, theBody, theSender, theName, theAddress, theAttachment, theSignature, toSend)
tell application "Mail"
set newMessage to make new outgoing message with properties {visible:true, subject:theSubject, content:theBody & return & return}
tell newMessage
set sender to theSender
make new to recipient at end of to recipients with properties {name:theName, address:theAddress}
tell content to make new attachment with properties {file name:theAttachment as alias} at after the last paragraph
if theSignature is not "" then set message signature to theSignature
end tell
activate
if toSend then send newMessage
end tell
end new_Mail