You need to sign in to do that
Don't have an account?
Soujanya_CG123
not able to add values to String array
Hi,
I am writing a trigger that will send emails. In this trigger i am adding email ids to an array as shown below
emails.add('soujanya.bussa@capgemini.com');
emails is String array.
But i am getting an exception that "invalid to address" while trying to send out the email.
But if i am passing like emails = new String[]{'soujanya.bussa@capgemini.com'}; the emails are sent.
So please help me to solve this issue.
I can add list but i cant pass list as argument to Message.setToadress()
Actually it was not working because
when i decalred array like this String[] emails = new String[4]; This array has 4 null values in it.
and when i added a value emails.add(emailId); this value is asdded at 5th position.
What i did is after decalring the array i cleared it
String[] emails = new String[4];
emails.clear();
and added the values to array and now it is working fine.
Thanks.