The CreatorCon Call for Content is officially open! Get started here.

one or more email address was invalid,(local address containing illegal character

nandini29
Tera Contributor

Hi 
I am getting below error in test but same script is working in dev , could you please help on this

nandini29_0-1758182829830.png

email script I am using in send email

var recepients = fd_data._1__get_catalog_variables.select_list_of_users_to_send_emails;

var groupmembers = new GlideRecord('sys_user_grmember');

groupmembers.addQuery('group','4809499747cb4e90c996889d416d43d0'); // KA_Rating_ApplicationGroup sys_id

groupmembers.query();

while(groupmembers.next())

{

recepients += ","+ groupmembers.user;

}

return recepients;

Could you please help on this, Thank you!

9 REPLIES 9

Ankur Bawiskar
Tera Patron
Tera Patron

@nandini29 

variable "select_list_of_users_to_send_emails" is of what type?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi @Ankur Bawiskar 
select_list_of_users_to_send_emails is a list collector

@nandini29 Did you check your user table ? Are there invalid emails?

 

Is this your prod instance? Subprod instances have invalid emails sometimes.


Raghav
MVP 2023
LinkedIn

@nandini29 

Did you print what came in that list collector and array and see if some email address has invalid character for the group members?

-> any space in the email address which you are fetching => if yes then use trim()

var recepients = fd_data._1__get_catalog_variables.select_list_of_users_to_send_emails;

var groupmembers = new GlideRecord('sys_user_grmember');
groupmembers.addQuery('group', '4809499747cb4e90c996889d416d43d0'); // KA_Rating_ApplicationGroup sys_id
groupmembers.query();
while (groupmembers.next()) {
    recepients += "," + groupmembers.user.email.trim().toString();
}
gs.info('Recipients are' + recepients);
return recepients;

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@nandini29 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader