Want to send mail from APEX, From the LWC UI component, I send the following email list and get an error.
To remove the double-quote from the email string and put in the string list I used the following syntax
List<String> emails;
if (toAddressesArray != '') {
emails = toAddressesArray.replace('\"', '').split(',', 0);
}
Email list
[[email protected],[email protected]]
On apex set
toAddresses:::([[email protected], [email protected]])
Error
failed::SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS,
Email address is invalid: [[email protected]: [toAddresses, [[email protected]]
Emails are valid, when I used a static list it's work perfectly, but it not work with a dynamic list.
static list
new List<String>{ '[email protected]' }