New Mail message with proper signature?

I want to create a new message in Apple Mail in my wife’s account. When I run this:

tell application "Mail"
	make new outgoing message with properties {visible:true, sender:"wifeaccount@mindspring.com "}
end tell

I get a new message window, but it has the default signature from my account.

Is there a way to specify the signature which is supposed to show up for her account, as set in accounts Preferences?

Thomas S. England

Model: iMac
AppleScript: 2.2.1 (100.1)
Browser: Safari 531.9
Operating System: Mac OS X (10.5)

Hi,

This is very similar to the question posted here a few days ago: http://macscripter.net/viewtopic.php?id=30187

How about:

tell application "Mail"
	set myMessage to make new outgoing message with properties {visible:true, sender:"wifeaccount@mindspring.com "}
	set message signature of myMessage to signature "signature name" 
end tell

Best wishes

John M

Thanks, John, that works!

I had done a search, but didn’t spot that one.

I had also tried many variations on “set message signature” but none of mine included “myMessage”.

Thanks for your prompt & useful response.

Hi Thomas,

‘myMessage’ is just a variable that holds a reference to the created message that allows you to do things with it. It could be something different, ‘x’ perhaps, but using meaningful variable names will help make scripts readable.

John M

you can even refer to the message without using a variable


tell application "Mail"
	tell (make new outgoing message with properties {visible:true, sender:"wifeaccount@mindspring.com "})
		set message signature to signature "signature name"
	end tell
end tell