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 "xxx@2.com"
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 "123@mail.com"
end tell
send newMessage
end tell
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.
If you don’t use the script triggered by a rule in Mail.app, 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 .
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.
anyway,
OK did you use mine (with a “P” of course )? 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 <123@mail.com>"
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?
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"
activate
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).