Bcc notification mail not sent

aladpereira
Mega Expert

Hello all,

I am trying to set notification email bcc for all CI managed by, ci support group manager and for all users.   i have tried a script, its not sending mail for those users. i have tried by putting the email directly in the email script, but no luck.   i am trying this in email notificati0n script.   and calling it in the body of the email notification. Can anyone say where i am going wrong.   Also if in need to push all in a single mail by adding all the email in bcc using array how to do that. tried this part also but failed. any help in these will be helpful.

Code :

      var str = ci_item.support_group;                                                     // need to send mail for all users in this group.

      var   str1 = ci_item.support_group.manager;                 // need to send mail for the group manager.

      var str2 =   ci_item.managed_by;                                                   //need to send mail for this user.

      //       gs.log("first "+str+ " " + str1 + " " + str2);                             checked in the log its   displaying the value

      var user = new GlideRecord('sys_user_grmember');

      gs.log("first "+str.getDisplayValue());                                                   checked in the log its   displaying the value

      user.addQuery('group',str);

      user.query();

      while(user.next()){

              // var mgrID = user.manager;

              gs.log("inside "+user.group.getDisplayValue());                             checked in the log its   displaying the value

              var user1 = new GlideRecord("sys_user");

              user1.addQuery("sys_id", user.user);

              user1.query();

              while (user1.next()) {

              email.addAddress("bcc", user1.email, user1.getDisplayValue());

                      gs.log("user "+user1.email+ " " + user1.getDisplayValue());                                                 checked in the log its   displaying the value

              }

              email.addAddress("bcc", str1.email, str1.getDisplayValue());

              email.addAddress("bcc", str2.email, str2.getDisplayValue());

      }

      gs.log("last "+ str1.getDisplayValue() + " " +str2.getDisplayValue() );                                       checked in the log its   displaying the value

Regards,

Alad.

3 REPLIES 3

Dub Myers
ServiceNow Employee
ServiceNow Employee

Please see Scripting for Email Notifications - ServiceNow Wiki   for how to add BCC/CC addresses to a notification via mail script.



You mentioned you are trying to send this in a "single email".



1. The ServiceNow email infrastructure will reject an email with 1000 or more total recipients (in TO, CC, BCC fields).   If using your own email servers, this number may be different.


2. ServiceNow is configured to break up emails into smaller groups of recipients.   For instance, putting 1200 recipients into an email notification would by default result in 12 emails, each with 100 recipients.     This functionality exists to handle email servers like ServiceNow's that have recipient limits.



Both 1 and 2 are documented here on the ServiceNow wiki here: Email Notifications - ServiceNow Wiki



3.   One issue is that prior to Geneva, there is a bug that prevents the recipient grouping described in (2) for the CC and BCC fields.   If there are too many recipients in CC or BCC then the functionality in (1) will reject your email.


We have experienced the same issue (bcc not sent), we are using fuji, just wondering if SNOW fixed this issue in Geneva?   Thanks


Dub Myers
ServiceNow Employee
ServiceNow Employee

Yes this fix was for Geneva