PDA

View Full Version : Automator action for sending draft mails via iCal event




marl0n
Apr 25, 2012, 10:20 AM
Hi all,
I'm trying to create an automator action that will look in a specific mailbox (sendlater), and then send all the messages in it. This automator action I want to trigger via an recurring iCal event (everyday at 2 and 4pm).
I don't get the action to work.. I guess because my applescript knowledge isn't sufficient. Error: message id 33240 of mailbox "Sendlater" of account "marlonbos@me.com" doesn’t understand the send message.

Is there someone who can tell me what I'm doing wrong?

Great thanks!
Greats, Marlon

(See my automator action attached)



kryten2
Apr 25, 2012, 09:27 PM
Have you tried a Send Outgoing Messages action as your third action instead of the run applescript action?

This action sends the outgoing email messages in the Mail application.

Note: If outgoing messages are passed from the previous action, only they will be sent. If no messages are passed in, all outgoing messages will be sent.

I found this on MacScripter by a member regulus6633. Big thanks to him. You need to have Enable access for assistive devices turned on. You can find it in System Preferences under Universal Access. No need for the Mail actions :

try
tell application "Mail"
activate
set the_messages to (every message of mailbox "sendlater")
set mess_viewer to first message viewer
set selected mailboxes of mess_viewer to {mailbox "sendlater"}
repeat with this_mess in the_messages
set selected messages of mess_viewer to (this_mess as list)
tell application "System Events" to tell process "Mail"
delay 0.2
keystroke "d" using command down & shift down
delay 0.2
keystroke "d" using command down & shift down
end tell
end repeat
end tell
-- end if
return this_mess
on error TheError
tell me to activate
display alert "An error has occurred:" message TheError as warning giving up after 20
end try