Mail Script Adding CC/BCC Recipients

Bradford Shelle
Kilo Guru

So I've been having issues trying to get an email script to add either CC or BCC recipients correctly. I'm referencing the example in the wiki article about adding them in, but I'm not quite sure what I'm doing wrong. My notification email script looks like

var gr = new GlideRecord('u_trainees');

var training = event.parm1;

gr.addQuery('u_training.number',training);

gr.query();

while (gr.next()){

  email.addAddress("cc", gr.u_email, gr.u_first_name + " " + gr.u_last_name);

}

and I'm calling it with

${mail_script:training_recipients}

in the notification.

As you can see, I'm not using the user table to grab people and names. I'm just finding the email field I made on a custom table and querying that table to get the trainees emails and names for the CC/BCC. Does anyone have an idea about what I'm doing wrong?

1 ACCEPTED SOLUTION

Even we have "Copied" field available in emails table.We can find the cc'd persons emails in that field.


View solution in original post

10 REPLIES 10

Bradford Shelle
Kilo Guru

Actually I might not be asking the right question...



I just tried to send an email from an incident with users in the To, CC, and BCC fields, but they don't seem to show up in the email logs. Everything is being sent to a test email account as well. So how can I tell if there really is an email address in the CC/BCC fields in the logs?


Hi Bradford,



                    Tell them that what ever we are sending it will go to test mail id only. If they really wants to see then open email properties and remove test email id.


I'm sending everything to a test email account for our Development and Test instances just so our users don't get flooded by emails. I'm just trying to figure out a way to look at an email in an email log and be able to pick out the CC and BCC fields. The way I was able to find out that I couldn't easily see those fields in the log was creating a test email from an incident in our Test instance, then populating the To, CC, and BCC fields with different emails. I can only see the To field in the email log file though...



So there's a possibility that my script posted before is working right, but I just don't know how to tell haha.


Who ever recive the mail ask them either they are in CC or not?