Bring New Mail Message to front

I adjusted the script that comes with mac’s mail program to send out new messages. The only issue is that is doesn’t send the message with the send command. I set the script to set visible to true to see what was going on, and I saw that the new message wasn’t activated, or brought to the front before the send mail command was processed.

I need to add a line before the send mail command that activates the new message window, or brings it to the front before it sends it out. Any ideas?


...
tell application "Mail"
	set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody & return & return}
	tell newMessage
		-- Default is false. Determines whether the compose window will
		-- show on the screen or whether it will happen in the background.
		set visible to true
		set sender to theSender
		make new to recipient at end of to recipients with properties {address:theAddress}
		send message
		delay 10
	end tell
	-- delay to allow the Mail program to send and not bog down, adjust as needed
end tell
tell application "Mail" to quit

Hi,

as the outgoing message is already referenced in the tell block

send

is sufficient. message as parameter does never refer to the current outgoing message