Mail - 10.7 Mail sending email

Hey all,

I’m having a problem composing an email through an applescript in 10.7 which worked in 10.6 but doesn’t in 10.7. But now I get an error.


set the_mailto to "emai1@email.com"
set the_Account to "yourAccountOfChoice@mail.com"
set the_subject to "subject"
set the_content to "content"

tell application "Mail"
	activate
	set newMessage to make new outgoing message with properties {sender:the_Account, address:the_mailto, subject:the_subject}
end tell

Any help would be appreciated.


set the_mailto to "emai1@email.com"
set the_Account to "yaddah@baddah.com"
set the_subject to "subject"
set the_content to "content"

tell application "Mail"
	activate
	set newMessage to make new outgoing message with properties {visible:true, subject:the_subject, content:the_content, sender:the_Account}
	tell newMessage to make new to recipient at the end of to recipients with properties {address:the_mailto}
end tell

maybe this works? I added the visible:true property so I could see the result :slight_smile:

I have a problem too with Mail in 10.7. The “content” property produces an error:

tell application “Mail”
set myMessage to make new outgoing message with properties {subject:“Mike”, visible:true}
tell myMessage
set the content to “Testing”–It fails here
end tell

end tell

I get “AppleEvent Handler failed” at the “set the content…” line. It makes no difference whether I try to enter the content as above, or as a property in the “set myMessage…” line.

The script runs OK in 10.6, so either it’s a bug in 10.7, or possibly I’ve got an incompatible osax which also defines “content”. Any ideas? Could some kind person please try this on their 10.7 and see what happens?
Thanks
Mike

Model: MacBookPro Core 2 Duo
AppleScript: Lion
Browser: Safari 5.1
Operating System: Other

if you remove “address:the_mailto” from the

address:the_mailto
set newMessage to make new outgoing message with properties {sender:the_Account, address:the_mailto, subject:the_subject}

It’ll work just fine. That seems to get it working

and I tried your code mike and it works as is.

Very strange, but thanks for the feedback. Must be a conflict somewhere, I think. Now, I know it’s me, I’ll have another hunt :slight_smile:

Best wishes

Mike

Got it - Attachment Tamer either needed updated or was corrupt. Not sure which, but downloading it and reinstalling fixed it!

Thanks again for your help.

Mike