Bcc notification configuration"

Matheus Rissi2
Tera Expert

Hello everyone,

I am currently configuring a notification that is triggered by an event in my flow.
To send the notification, I need to set the "Event parm 2 contains recipient" option to true.

However, I don't want these emails to be sent as "To" but as "Bcc" instead.
What should I do?

Emai Script:

 

(function runMailScript(current, template, email, email_action, event) {

    //email.clearAddress(); 
    // Extrair informações do evento
    var txt = event.parm1; // Assunto e conteúdo
    var add = event.parm2; // Destinatários

    txt = txt.toString().split('%%');


    // Extrair nome e email
    var displayName = add.substring(0, add.indexOf('<')).trim(); // Nome
    var emailAddress = add.substring(add.indexOf('<') + 1, add.indexOf('>')).trim(); // Email

    if (emailAddress != "") {
		email.setFrom("");
        email.addAddress('bcc', emailAddress, displayName); // Adiciona como BCC
    }

    email.setSubject(txt[0]);
    template.print(txt[1]);

})(current, template, email, email_action, event);

 


The email is currently being sent:
 

MatheusRissi2_0-1728910519458.png



Thank you in advance to anyone who can help.

 

1 REPLY 1

Voona Rohila
Mega Patron
Mega Patron

Hi @Matheus Rissi2 

Do you have some other users you want to send in TO? or you want to make TO to empty?

 

Try this if you want TO address to empty

https://www.servicenow.com/community/developer-forum/email-notification-using-solely-bcc-recipients/...

 

 

You can uncheck 'Event parm 2 contains recipient' and use your logic.

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP