-1

I have installed Sitecore 9.0.2, using EXM feature to send email from Sitecore 9 Form.

I have two email Ids for Email To and Email CC in two hidden field. So I am able to send email for Email To but didn't find any option to add Email id's in CC.

If anyone across these issue, please share your solution. Thanks

1

Out of the box it is not possible to add contacts CC in EXM.

If you are determined to do this, you would have to write a custom processor to register on the SendEmail pipeline.

public class CCMailProcessor
{
    public void Process(SendMessageArgs args)
    {
        if(!(args.EcmMessage is MessageItem ecmmessage))
            return;
        if (!(args.CustomData["EmailMessage"] is EmailMessage message))
        {
            args.AddMessage("Missing EmailMessage from arguments.");
            return;
        }
        message.Headers.Add("CC", "someone@just.com");            
    }
}

Register on pipeline

<SendEmail role:require="Standalone or ContentManagement or DedicatedDispatch">
    <processor patch:before="*[@type='Sitecore.EmailCampaign.Cm.Pipelines.SendEmail.SendEmail, Sitecore.EmailCampaign.Cm']"
               type="CCMailProcessor, Feature.MyPackage" resolve="true" />
  </SendEmail>
| improve this answer | |
  • I advise extreme caution when modifying that part of the EXM pipelines. Depending on the logic used could have negative side effects on dispatch. – Pete Navarra Nov 14 at 4:44
  • Did you have some bad experiences Pete? – Bart Verdonck Nov 14 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.