1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Automator action for sending draft mails via iCal event

Discussion in 'Mac Programming' started by marl0n, Apr 25, 2012.

  1. macrumors newbie

    #1
    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)
     

    Attached Files:

  2. macrumors 6502a

    #2
    Have you tried a Send Outgoing Messages action as your third action instead of the run applescript action?

    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 :

    Code:
    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
    
     

Share This Page