Hi
I am trying to dynamically change an email recipients list based on a selection that the user will make. I pull the email addresses from the database and then I group concatenate them into a string with a separator between them. When I assign this string to the script it is adding quotes before and after the string which I believe is leading to errors when I try to send the email. I have tried various combinations of double and single quotes but no success. if I type it the addresses manually with double quotes around them as in the manual example it works ok.
This is the type of string I am assigning in the script to the variable [color=#FF0000]Contacts[/color]
“bob@yahoo.ie”,“bob@gmail.com”
I have tried removing the quotes and adding single quotes,three quotes but none work
[color=#FF0000]Contacts = event.source.Recipients
#NEW DATASET READY TO BE SENT IN EMAIL
newDS = system.dataset.toDataSet(TableHeader, Data)
#Convert DataSet to HTML For Sending In EMAIL
EmailHTML = system.dataset.dataSetToHTML(1, newDS, “MAINTENANCE REPORT”)
Emailbody = “
MAINTENANCE REPORT
”+ EmailHTMLEmailRecipients = [Contacts][/color]
This is the error I get when I try send the email.
Thanks
Aidan
Traceback (innermost last):
File “event:actionPerformed”, line 24, in ?
com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Gateway Error 500: Error sending email.
Caused by: javax.mail.internet.AddressException: Illegal address in string ``“bob@yahoo.ie”,“bob@gmail.com”’’
com.inductiveautomation.ignition.client.gateway_interface.GatewayException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Gateway Error 500: Error sending email.
Ignition v7.2.7 (b170)
Java: Sun Microsystems Inc. 1.6.0_26