Send html content with mail app and applescript

Hi everyone, I'm trying to develop an App in applescript to send an email with an html form, Its a quality survey for our clients, and the idea is convert it to an automatic process. My question is how to send html content with mail using applescript. When I set up theMessege to get html content, doesn't work ...send mail but without html content.... I'm currently doing it using safari and the "email contents of document 1" after opening the html file that ive created before but the problem its that I can't choose the sender account and have to fill it manualy. befor to send mail.....Below its the code that I can't get it to work fine,....thanks


on enviaEmail(theRecipientAddress, theSender, theSubject, theContentHtml, theRecipientAddressName)

tell application "Mail"

set elMensaje to make new outgoing message with properties {sender:theSender, subject:theSubject, visible:false}

tell elMensaje

set html content to theContentHtml

make new recipient at the end of recipients with properties {name:theRecipientAddressName, address:theRecipientAddress}

send

display notification "Se ha enviado el correo para los destinatarios: " & theRecipientAddress with title "Con asunto: " & theSubject subtitle "Es un correo de " & theRecipientAddressName sound name "frog"

end tell

end tell

end enviaEmail


I've try too with this other option (next below )and even changing "html content:theContentHtml" to other places as in properties of new recipient, or changing visible to true or false...


on enviaEmail(theRecipientAddress, theSender, theSubject, theContentHtml, theRecipientAddressName)

tell application "Mail"

set elMensaje to make new outgoing message with properties {sender:theSender, subject:theSubject, html content:theContentHtml,visible:false}

tell elMensaje

make new recipient at the end of recipients with properties {name:theRecipientAddressName, address:theRecipientAddress}

send

display notification "Se ha enviado el correo para los destinatarios: " & theRecipientAddress with title "Con asunto: " & theSubject subtitle "Es un correo de " & theRecipientAddressName sound name "frog"

end tell

end tell

end enviaEmail

Send html content with mail app and applescript
 
 
Q