Using Python to access Send Email properties

I'm trying to write a BeforeAction script in Python that needs to modify some of the properties of the Send Email Action.

I've been trying to use the help documentation for the Action, but the list of properties there doesn't seem to be Python-friendly (eg. Action.From.Address results in something which isn't a usable string in Python).

I've also been using the Properties panel, and that has helped a lot (eg. Action.FromObject.Address is a string I can use in Python).

However, I want to work with the RecipientsList, and I'm not at all clear on how I can do that. I've tried:

recipients = Action.RecipientsList

and that has given me something that seems to have at least some of the functions mentioned on the Send Email Help page for the IFBAddressList interface; I can get a Count of the recipients, for example. But when I try:

recipients.Item(i).Address

I get back something, which, again, isn't a string I can use in Python.

I'm also going to want to add to the list of recipients as well as read it, which means I need to be able to pass whatever is expected (a WideString?) to the Add function for the recipients list.

 

Am I going about this the wrong way? Is there a good source of info on the properties and how to use them?

Any help would be much appreciated!

 

Liam Routt - Krome Studios

Hi Liam,

Here is some example python code to access the action’s RecipientsList property:

for i in range(0, Action.RecipientsList.Count):    
  name = Action.RecipientsList.Item(i).Name()    
  address = Action.RecipientsList.Item(i).Address()    
  print name + '' + address
Action.RecipientsList.Clear()
Action.RecipientsList.Add'Paul', 'paul @ finalbuilder.com')

Hope that helps

Works like a charm. Thanks for clearing that up for me.

Am I looking in the right places for documentation of these things (the Help file, mainly)? I'm still a bit confused as to why I seemed to have to use FromObject, rather than From. Or is that simply an alias, and I could have used From.Address() to get the string I was initially expecting?

Liam Routt - Krome Studios