Script no longer sends mail since upgrade to 10.5

I use the script below to generate mail messages. Under 10.4 it would just send the message, now under 10.5 it puts it in the Out Box and that is it. Anybody knows how to fix this so it sends it immediately?

set theBody to "abc"
set theSubject to "XYZ"
set theTarget to ""
tell application "Mail"
set newMessage to make new outgoing message with 
roperties {subject:theSubject, content:theBody}
tell newMessage
make new to recipient at end of to recipients with properties {address:theTarget}
set sender to ""
end tell
send newMessage
end tell



the script should work “stand alone”
But in Leopard sending a mail from within a rule is broken

StefanK greetings

I do not understand this comment

Could you explain what you mean?

Please kindly let me point your attention to this excellent article :wink:

a excellent article no doubt! But as a beginner I do not get it. could you please explain as to how to use this?

here is what I did, made the first script in to an application. when starting the second one it ask for a application, I select script 1 and nothing else happens.


“Is broken” means doesn’t work any more

If you don’t use the script triggered by a rule in, forget it.
The workaround is only necessary for this particular case.
A straight script works, I tested it on my machine with Leopard

what I figured too, according to my knowledge of the English language, even in Scotland it wold be so :slight_smile: .

My question was, how does it fix my problem as you send me to the other site? as you say,

it seems to not do so. so leaves me confused as to whay you pointed at it.


OK did you use mine (with a “P” of course :slight_smile: )? because mine does not on my machine and 10.5. could you post yours for me to try? can you set it to any sender?


Yes, I used your script with “p” and with valid addresses using this syntax

property theName : "xyz"
make new to recipient at end of to recipients with properties {name: theName, address:theTarget}
set theSender to "John <>"

and it did send it out and did not put it in the ‘Outbox’, and leave it there?

and it did change the sender to

If so very strange indeed! Because it does not work on my end.

I am on Mail V3.3 what version are you on?

Yes, it did everything.
I use Mail 3.4 (system version 10.5.4)


I just tried on a different machine and have the same result.

I am on 10.5.4

Now I assume Mail is part of a update? Or is there a separate update? I can not find one though.

Maybe this is the problem?

I just tried it again with three different accounts. Worked perfectly.
It could be, that Mail has been updated with the security update a few days ago.

Are you sure, recipient and sender are definitely valid?

I updated too recently. so why am I not on the same version as you?

150% they work on the 10.4 machine.

I don’t know, why the versions are different,
my version and build number of is Version 3.4 (928/928.1)

Mine is Version 3.3 (926.1/926)

Strange indeed, as I uploaded the latest version of the OS

Stefan good morning,

the plot thickens. I have an other MBP with a fresh 10.5.4 instal and all the latest updates (checked this morning if they are). it has mail 3.3 on it! and here too the same problem exist.

Now I discovered something else. if Mail is running it does work. if Mail is quit and needs to start up it does not. if I put a extra line in after - tell application “Mail” - with a dealy it works.

tell application "Mail"
delay 5

so I suppose this means the computer is to fast for the mail program? Or? anyway that is one problem solved. still it does not set the address properly.

FMI. What machine do you have your mail version running on? any idea if different machines might have different versions on it (seems crazy)?

Ok, that could be, Mail is running on my machine all the time.
But I think the delay line is not needed, the script should wait after the activate line.

I’m using a G5 Dual 2,5 GHz, on my PowertBook is still Tiger.
I have no idea, why different machines have different mail versions on it.
Unlike Tiger, Leopard uses an unique system for both Intel and PPC

to see if this would fix it (sometimes it does) I just ran the combo update again on my other machine and this puts/leaves the 3.3 version of Mail on it. However now the script runs without the delay.

I did not know this as I do not have any PPC left (sold lat one last week) to test check.

So that could be it. still a bugger as I now need to develop a new way of scripting this. any ideas for a person with my limited scripting skills?

I doubt that the problem occurs only on Intel machines.
The syntax in your script is the common way to create and send a new message.
Take a look at this mactech article

I am reading, and running some of the scripts they suggest (to test) and when I run any script with AppleScriptGuru in it it gives me the following error.

could this have anything to do with my problem? (I have no clue as to what the AppleScriptGuru is/does though).