on composeMail(email_recipient, email_subject, email_content, the_file)
	
	try
		tell application "Microsoft Outlook"
			activate
			
			set email_content to my findAndReplace(return, "<br>", email_content)
			
			
			set tmp to make new outgoing message with properties {subject:email_subject, content:email_content}
			if (email_recipient is not "") then
				make new to recipient at tmp with properties {email address:{address:email_recipient}}
			end if
			make new attachment at tmp with properties {file:the_file}
			open tmp
			
			
		end tell
	end try
	
end composeMail

on findAndReplace(tofind, toreplace, TheString)
	set ditd to text item delimiters
	set text item delimiters to tofind
	set textItems to text items of TheString
	set text item delimiters to toreplace
	if (class of TheString is string) then
		set res to textItems as string
	else -- if (class of TheString is Unicode text) then
		set res to textItems as Unicode text
	end if
	set text item delimiters to ditd
	return res
end findAndReplace