Salesforce

Salesforce

How to avoid sending emails to specific emails from Salesforce?

1. Create a custom object to hold the exception emails. 2. Create records in the custom object. 3. Use the below code. trigger EmailMessageTrigger on EmailMessage ( before insert ) {              Set < Id > setEmailRecIds = new Set < Id >();       Set < String > setEmailAddress = new Set < String >();       Set < String > notAllowedEmails = new Set < String >();       Map < Id, String > mapRecIdEmail = new Map < Id, String >();              for ( EmailMessage objMsg : trigger.new ) {   ....