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:
"", ""

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: "", ""

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’“”, ""’]
and then the email fails with a bad address.

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


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’)+"]")