Send Email Report to Variable Email Adresses

Dear All

Is there a way to send a report to variable addresses?
I’m working in a user application that lets a certain user choose the destination addresses by check-boxes.
I have already worked my way on concatenating the email strings according on which ones and how many are selected.
the final string looks something like: “","”,"**"
I’m using the next script:
the string is stored in a variable called “completestring”“PathName”, project=“ProjectName”, action= “email”,
actionSettings = {“to”:[completestring], “smtpServerName”:“ServerName”, “from”:“Ignition@****.com”, “subject”:“SubjectName”, “body”:“body”,“attachmentName”:attachname})

The problem is that the mails are not being sent, I’m printing the variable to the console so I know that the concatenating is ok and if I copy the result text and paste on the destination mail it works ok.
Am I calling the variable wrong on the ?

The To list probably just has one item, your concatenated string. You can confirm this by printing len(completeString) and seeing if it’s just 1. If that’s the case, you’ll want to split the string into a list:

completeString = ",,"

emailList = completeString.split(",")
actionSettings = {"to":emailList, ...
1 Like

Thank you so much, I tested by splitting it onto a list and worked perfect.
Thank you very much!!!

You are very welcome, also welcome to the forum!