Hi,
I am writing a script that will create a reply all of a message with an adjusted subject. I would like to do this in a ‘clean’ method (meaning without GUI scripting where possible. I can’t use the ‘reply to’ applescript function because it doesn’t allow me to change the subject, therefore I gather all info from the mail and create a new mail manually.
I now discovered a problem with this method. All the returns are removed if I get the content of a mail which is formatted in plain text, and use the same content to create the new message. Is there anyway I can resolve this?
tell application "Microsoft Outlook"
-- listSelectedItems : a list of all items selected in Entourage
set listMessages to current messages
-- Check to make sure items are selected, if not then quit
if ((count of listMessages) > 1) then
display dialog "Please only select one message!"
return
end if
if ((count of listMessages) is not 1) then return
set theMail to item 1 of listMessages
-- Gather info from the mail to be able to create the reply
set theAccount to email address of (account of theMail)
set toRecipientslist to email address of to recipients of theMail
set ccRecipientslist to email address of cc recipients of theMail
set theSubject to subject of theMail
set theBody to content of theMail
-- Create the Reply message and fill in to and cc fields
set theReply to make new outgoing message with properties {subject:theSubject, content:theBody}
repeat with i from 1 to number of items in the toRecipientslist
set theRecipient to item i of toRecipientslist
try
set theRecipientName to (name of theRecipient)
on error
set theRecipientName to (address of theRecipient)
end try
make new recipient at theReply with properties {email address:{name:(theRecipientName), address:(address of theRecipient)}}
end repeat
repeat with i from 1 to number of items in the ccRecipientslist
set theRecipient to item i of ccRecipientslist
try
set theRecipientName to (name of theRecipient)
on error
set theRecipientName to (address of theRecipient)
end try
make new recipient at theReply with properties {email address:{name:(theRecipientName), address:(address of theRecipient)}}
end repeat
open theReply
end tell