Sendto and CopyTo array

I have a script that sends email to a group of users. The NYRMTTGrpEmail is an array. I want to be able to add a Copy to. I’ve tried different methods but i’m not able to make it work. any assistance will be appreciated. The email only goes to the people under NYRMTGrpEmail.

RecipField = curdoc.GetItemValue(“NYRMTGrpEmail”)

Forall n In RecipField

Set Names = New NotesName(n)

If MDoc.HasItem(“Recipients”) Then

Call MDoc.GetFirstItem(“Recipients”).AppendToTextlist(Names.Addr821)

Else

MDoc.Recipients1 = Names.Addr821

End If

End Forall

MDoc.SendTo=RecipField

MDoc.CopyTo=curdoc.getitemvalue(“CreatedBy”)(0)

Call Body.AppendText(“An Emergency Change Request has been submitted. Details are given below:”)

Subject: Sendto and CopyTo array

Are you sure your ‘CreatedBy’ field is populating correctly? Everything looks fine to me and I would expect it to work.

Subject: Sendto and CopyTo array

Try removing (0) in:MDoc.CopyTo=curdoc.getitemvalue(“CreatedBy”)(0)

as MDoc.CopyTo=curdoc.getitemvalue(“CreatedBy”)

This should work as getitem value returns a variant and copyto is a multivalue.