Issue sending email with system.net.sendEmail script

Hello, me again. I’m setting up a manual notification to request for signatures from other employees when we need to authorize a part change/update. I have a list of emails in a power table, the user selects which email they wish to send notification too and Ignition will email to that selected user along with relevant information. Using this script I can send email to myself because I’m just typing it in:

body = "Hello, I am attempting this."
recipients =["dholt@mail.com"]

system.net.sendEmail("mymailserver.server.com",
 "dholt@mail.com", "Here is the email!", body, 0, recipients)

I have a hidden label that reads the selection in the power table and gives the email address for the selected recipient, but when I use this:

body = "Hello, I am attempting this."
recipients = event.source.parent.getComponent('email_lbl').text

system.net.sendEmail("mymailserver.server.com",
 "dholt@mail.com", "Here is the email!", body, 0, recipients)

It doesn’t work. I’m sure it has to do with the python list [""] but I’m not sure how to correct that. Anyone help? Thanks in advance!

Have you tried this?

body = "Hello, I am attempting this."
recipients = [event.source.parent.getComponent('email_lbl').text]

system.net.sendEmail("mymailserver.server.com",
 "dholt@mail.com", "Here is the email!", body, 0, recipients)
2 Likes

That was it. Is there an award for “Most helpless”? lol. Thanks!