setting the return address in mail.app

In the following script I seem to be having a problem setting the return address variable myAddress. It is leaving the “To” line empty on the e-mail that is being created.

–set reply variables
set theSubject to “Hello to You”
set theBody to “How are you today??”

–open the mail application
tell application “Mail”
–delete activate when out of debug
activate
–get messages from “test” mailbox
set theMessage to messages of mailbox “test”
–test each message to see if subject=“Hello”
repeat with eachMessage in theMessage
if subject of eachMessage is “Hello” then
–if subject=“Hello” then set the return address to sender of original
set myAddress to sender of eachMessage <----This line is where the problem is I believe
–create the new e-mail
set newMessage to make new outgoing message with properties ¬
{recipient:myAddress, subject:theSubject, content:theBody & return & return}
end if

	--delete the next tell block when finished with debugging
	tell newMessage
		set visible to true
	end tell
end repeat

end tell

Any suggestions? Also are there any good sites thaat concern the scripting of mail.app? I did a Google search but did not come up with any good ones. And Apple’s site concerning scripting Mail.app in my opinion SUCKS!!!

I think the script is breaking on the part that adds the address to a new outgoing message. Your script obtains the sender’s name and address as a single item and I think you might need to break it down to 2 individual items.

Apple installs sample scripts with OS X and there’s an example for creating a new message. If you don’t have it, or if it doesn’t help, let me know. On my machine, it’s named “Create New Message.scpt”.