Applescript to create body text for an email in Outlook 2011

We have a simple email apple script that works in entourage with predefined email address, Email subject and Email body Text. We are changing to outlook 2011 and I would like to update this script to make it work for outlook as well. I have figured out everything but one silly simple item.

When I have apple script enter in content for the email’s body in entourage it displays like this:

Date

Call Date:

Complaint Department:

Call received on 311 or 911:

Person Identifying Complaint:

Complaint:

Here is basically some of what I was working with in the Entourage script.

set the_content to ("Date:" & return & return & "Complaint Department:" & return & return & "Call received on 311 or 911:"  & return & return &  "Person Identifying Complaint:"  & return & return & "Complaint:")

set ComplaintMessage to make new message with properties { subject:the_Subject, content:the_content}

The way it makes it look in outlook 2011 is like this:

Date: Call Date: Complaint Department: Call received on 311 or 911: Person Identifying Complaint: Complaint:

For the line breaks I have been using & return & return and this does not seem to be working in outlook 2011. Is there any other way that I can make this work?

I am working on OSX 10.6.8

thanks
Shin.

I figured it out. The problem I was having was that Outlook was defaulting to html emails. So all I had to do was add

& "<br> <br> <br>" & 

instead of

& return & return & 

Now I need to figure out how to make Outlook default to text email for this email and I should be all set. I will post the whole code once I figure it out.

Here is my script so far for an HTML email sent in outlook. I am still trying to figure out what command to send to outlook to make the message text.


--This applescript will create an email in outlook 2011 that will send an email to certain recipiants and generate the email body text.  It is an html email.
--This is used as a simple form that our dispatchers fill out in order to file complaints.
--Instructions.
--Change the names of ccName to what you want the email display name to be and change ccAddress to the email address you want this sent to
--Put this in your outlook scripts menu and run it from the script menu once inside outlook


-- Below is the config:
set {ccName01, ccAddress01} to {"LocalDispatch", "change-Alias@change-email.com"} -- 'Cc:' recipient.
set {ccName02, ccAddress02} to {"ChangeName", "change-Alias@change-email.com"} -- 'Cc:' recipient.
set {ccName03, ccAddress03} to {"ChangeName", "change-Alias@change-email.com"} -- 'Cc:' recipient.
set the_Subject to "Dispatch Complaint Email"
set the_Content to ("<b>" & "Date:" & "</b>" & (do shell script "date") & "<br><br>" & "<b>" & "Complaint Department:" & "</b>" & "<br><br><br>" & "<b>" & "Call received on 311 or 911:" & "</b>" & "<br><br><br>" & "<b>" & "Person Identifying Complaint:" & "</b>" & "<br><br><br>" & "<b>" & "Complaint:" & "</b>")

tell application "Microsoft Outlook"
	
	set ComplaintMessage to make new outgoing message with properties {subject:the_Subject, content:the_Content}
	
	make new cc recipient at ComplaintMessage with properties {email address:{name:ccName01, address:ccAddress01}}
	make new cc recipient at ComplaintMessage with properties {email address:{name:ccName02, address:ccAddress02}}
	make new cc recipient at ComplaintMessage with properties {email address:{name:ccName03, address:ccAddress03}}
	open ComplaintMessage
	
	
	
end tell

Hopefully this can help someone else.
-Shin

Hi Shinuson -

Just wanted to let you know that this script worked great for me - thank you for posting!

krt1

Very late response, but I just ran across this post…

If you set the property to {plain text content:the_Content}, then the new outgoing message will be in plain text instead of HTML.