I did some testing on my end and I was able to conditionally stop emails from being sent on a per template basis. I accomplished this by adding an if
condition in the subject of the template. If the condition evaluates to true
, then it will insert the #stop
variable so the email is not sent. If the condition is false
, then the #stop
variable won’t be inserted into the subject, and the email will be sent. Here is what I put in the subject:
#if(true)#stop#end A user has been granted ${accessProfileName} via a role request
Since the subject can contain if-else logic, you should be able to conditionally send the email using the global and local variables available to each email template, which you can find here. In your case, you want to use an identity attribute that will tell you if the identity the email is being sent to is an executive. You can try something like #if( $user.title == 'Director' || $user.title == 'Executive')#stop#end
. The properties available on a given $user
are dependent on the identity profile attributes that are mapped.