Search code examples
applescriptapple-mail

Get the recipient of a draft (AppleScript, Mail.app)


I want to get the recipients ("to" fields, etc) of a draft on my draft's folder of Mail.app, by using AppleScript. Can't seem to find the correct syntax to that.

Thanks.


Solution

  • Here's code to do it, in Scripting Bridge (Cocoa):

    for (MailRecipient *recp in message.recipients) {
                    MailToRecipient *theRecipient = [[[mail classForScriptingClass:@"to recipient"] alloc] initWithProperties:[NSDictionary dictionaryWithObjectsAndKeys:recp.address, @"address", nil]];
                }