function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tony White (BNE)Tony White (BNE) 

Why is the case owner getting a copy of the email to the case contact?

We have a trigger using a single email message to send an email to a contact on a case, and save it as an activity on the case/contact.  But we are finding that the case owner is also getting a copy of the email.  Why?

This is the send email code we are using:
--------
                       Messaging.SingleEmailMessage singleMail = new Messaging.SingleEmailMessage();
                        //set object Id
                        singleMail.setTargetObjectId(contact.Id);
                        //set template Id
                        singleMail.setTemplateId(TemplateName));
                        // Set the whatId
                        singleMail.setWhatId(case.id);
                        //flag to true for inserting activity history
                        singleMail.setSaveAsActivity(true);
                        // Set the from address
                        singleMail.setOrgWideEmailAddressId(noReplyAddress.ID);

                        //add mail
                        emails2Send.add(singleMail);
....
Messaging.sendEmail(emails2Send);