<p>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.</p>

<p>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.</p>

<p>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.</p>

<p>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:</p>

<ol>
<li>Information about the Notification Email itself, like the Subject Line. This info is available via the <code>entry</code> object (i.e. <code>{{ entry.subjectLine }}</code>)</li>
<li>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 <code>object</code> variable (i.e. <code>{{ object.value }}</code>), but the available values will differ based on the event.</li>
</ol>

<p>To fix this issue, you need create templates for your Notification Email that:</p>

<ol>
<li>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.</li>
<li>Are designed to expect the right variables for the Event that they are being used for.</li>
</ol>

<p>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.</p>

<p>Sprout Email creates a log file at <code>craft/storage/runtime/logs/sproutemail.log</code>. You should see any template errors that may be happening there to help troubleshoot and diagnose what is happening.</p>

CC BY-SA 3.0
2015-09-02T05:04:03.150Z
2015-09-02T05:04:03.150Z
Ben Parizek
<p>Using the Sprout Email plugin. The only notification triggers that are working are related to users. Any notifications with triggers related to entries (created, updated, deleted) do not send an email, not even a test email.</p>

<p>I'm using Craft Client 2.4.2688.</p>

CC BY-SA 3.0
2015-08-27T01:01:48.537Z
Hey Ryan, Are you using the same notification and settings for both the User and Entries scenarios? Are you using any custom variables in your template that may be specific to one scenario and not the other?  Can you update the post here with more information on the settings you have for both scenarios and what your templates look like?
Ben Parizek
CC BY-SA 3.0
2015-08-28T18:19:05.470Z
Hey @BenParizek, I'm actually just using the example notifications and templates that were set up upon plugin installation. : https://infinit.io/_/Bz2xTTZ
Ryan James
CC BY-SA 3.0
2015-08-29T14:20:02.987Z
Sounds like we may need to dig a bit deeper here.  Can you send over your logs and db to sprout@barrelstrengthdesign.com?
Ben Parizek
<plugin-sproutemail>
Entry saved trigger not working
# Entry saved trigger not working

(Asked by: username_0 on 2015-08-26)

Using the Sprout Email plugin. The only notification triggers that are working are related to users. Any notifications with triggers related to entries (created, updated, deleted) do not send an email, not even a test email.

I'm using Craft Client 2.4.2688.

**Tags:** plugin-sproutemail
> **Comments:**
> **username_1**: Hey Ryan, Are you using the same notification and settings for both the User and Entries scenarios? Are you using any custom variables in your template that may be specific to one scenario and not the other?  Can you update the post here with more information on the settings you have for both scenarios and what your templates look like?  
> **username_0**: Hey @BenParizek, I'm actually just using the example notifications and templates that were set up upon plugin installation. : https://infinit.io/_/Bz2xTTZ  
> **username_1**: Sounds like we may need to dig a bit deeper here.  Can you send over your logs and db to sprout@barrelstrengthdesign.com?  

---

## 1 answers

### Answer by username_1 on 2015-09-02. Score: 2

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:

1. Information about the Notification Email itself, like the Subject Line. This info is available via the `entry` object (i.e. `{{ entry.subjectLine }}`)
2. 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:

1. 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.
2. 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.


---

