Email problem

I would like to send an email to a group of recipients defined by a tag, my tag is a string such as this:
"person1@mail.com", "person2@mail.com"

when I send the email I get invalid address error.

for recipients I use something like this:

recipients = system.tag.getTagValue(‘SSB/Inv/Email_Recipients/Email_Recipient_ListDaily’)

and what gets returned is: "person1@mail.com", "person2@mail.com"

but it needs to be in square brackets so I tried this:

recipients = [system.tag.getTagValue(‘SSB/Inv/Email_Recipients/Email_Recipient_ListDaily’)]

and Ive also tried:

recipients = [recipients]

the problem is what gets returned is : [u’“person1@mail.com”, "person2@mail.com"’]
and then the email fails with a bad address.

any ideas how to create a recipients list from a string value?

thanks

Try splitting the string value you read from the tag on a comma:

recipients = system.tag.getTagValue('SSB/Inv/Email_Recipients/Email_Recipient_ListDaily')
recipients = recipients.split(',')

someone here in the office suggested using eval which to my surprise worked:

recipients = eval("["+system.tag.getTagValue(‘SSB/Inv/Email_Recipients/Email_Recipient_ListDaily’)+"]")