# Email Address List Format Issue

**URL:** <https://forum.inductiveautomation.com/t/email-address-list-format-issue/3093>\
**Category:** Ignition\
**Created:** [July 13, 2011, 10:19am UTC](https://forum.inductiveautomation.com/t/email-address-list-format-issue/3093 "2011-07-13T10:19:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aidamcg](https://avatars.discourse-cdn.com/v4/letter/a/90db22/32.png) [@aidamcg](https://forum.inductiveautomation.com/u/aidamcg)\
**Post date:** [July 13, 2011, 10:19am UTC](https://forum.inductiveautomation.com/t/email-address-list-format-issue/3093/1 "2011-07-13T10:19:55Z")

</div>

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
”+ EmailHTML  
EmailRecipients = [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

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 13, 2011, 2:01pm UTC](https://forum.inductiveautomation.com/t/email-address-list-format-issue/3093/2 "2011-07-13T14:01:41Z")

</div>

It looks like you have a single string with all the contacts in that string. What you need is a python list that has your email address entries. Try replacing this:

`
EmailRecipients = [Contacts]`

With this:

`Contacts = Contacts[1:-1].split(',')
EmailRecipients = Contacts`

The split will convert your single string to a bonafide list. 😃

Regards,

---

<div class="post-metadata">

**Author:** ![aidamcg](https://avatars.discourse-cdn.com/v4/letter/a/90db22/32.png) [@aidamcg](https://forum.inductiveautomation.com/u/aidamcg)\
**Post date:** [July 13, 2011, 2:33pm UTC](https://forum.inductiveautomation.com/t/email-address-list-format-issue/3093/3 "2011-07-13T14:33:42Z")

</div>

Hi Jordan

Thanks for the help. Worked out ok

Aidan
