Py-appscript: How to configure mail created by reply()

I'm trying to reply to a mail in Mail.app with py-appscript.

I tried the code below,

from appscript import *

mailapp = app('Mail')

# get mail to be replied
msg = mailapp.accounts.first.mailboxes.first.messages.first

# create reply mail
reply_msg = mailapp.reply(msg)

# set mail (got error)
reply_msg.visible.set(True)
reply_msg.subject.set('replied message')
reply_msg.content.set('some content')

but got following error, it failed to set subject. (setting visible property is succeeded)

CommandError: Command failed:
        OSERROR: -10000
        MESSAGE: Apple event handler failed.
        COMMAND: app(u'/Applications/Mail.app').outgoing_messages.ID(465702416).subject.set('replied message')

It works when I use "make" instead of "reply" to create new message.

# create new mail
msg = mailapp.make(new=k.outgoing_message)

# set mail (works fine)
msg.visible.set(True)
msg.subject.set('new mail')
msg.content.set('some content')

Can you please tell me what this error is and how to fix it?

Answers


Works fine on 10.6 but there's a bug in Mail on 10.5 (and probably earlier) that causes outgoing messages created by the reply command not to work correctly.

If you have to support 10.5, I think your only option is to build a new outgoing message from scratch, copying the relevant information from the message you're replying to yourself.


Need Your Help

GameSalad like tools for PC

game-engine gamekit

Anyone knows of a tool like GameSalad for PC in which you don't have to write scripts or anything but just use the existing behaviors and events to create custom game logic?

how to parse json in php and javascript

php javascript json youtube-api

http://gdata.youtube.com/feeds/users/LadyGagaVEVO/uploads?alt=json&max-results=10&format=5