The Sprout Email Example Notification templates are designed to illustrate an example of the the Events that take place when a user is saved. They illustrate how to set custom variables for the User Events in both the Control Panel and in the template itself. While in most cases, you won't need to customize things in both places, the example is meant to be illustrative of what is possible so you can decide what the best option is for your situation.
The issue here arises when the Notification in the Control Panel is updated to be triggered on a Entry-related event, instead of a User-related Event, and the same notification template is used.
When the Entry-related Event is fired, the User-specific template tries to access user-specific variables and a Twig processing error causes the template to err out.
The key thing to understand here is that, when Sprout Email fires an Event, it only has two types of variables available to the template you are using:
- Information about the Notification Email itself, like the Subject Line. This info is available via the
entry object (i.e. {{ entry.subjectLine }})
- Information about the Event the trigger is associated with. This information may change depending on the Event you are using. This info is always available via the
object variable (i.e. {{ object.value }}), but the available values will differ based on the event.
To fix this issue, you need create templates for your Notification Email that:
- Are built in a generic way so that they make no assumptions about what variables will be passed to the template. If dynamic variables are needed, they can be handled directly in the fields within the Control Panel.
- Are designed to expect the right variables for the Event that they are being used for.
If you run into trouble, try simplifying the templates you're using to hard-coded text. Confirm that the Event is working as expected and that the Notification email is being fired as expected. Once you confirm that, then try to add in variables in one by one and testing to confirm you're adding the variables correctly.
Sprout Email creates a log file at craft/storage/runtime/logs/sproutemail.log. You should see any template errors that may be happening there to help troubleshoot and diagnose what is happening.