<p>This answer will focus on using Sprout Email for transactional emails.</p>

<h2>Transactional Emails</h2>

<p>First, a comment on semantics. I feel the question above is drawing a distinction between two types of transactional emails: triggered and automated.</p>

<p>Triggered emails are a one-off, context-specific email that get sent to a user when an event is triggered by a user's interaction with the application. Automated emails, which seems to be the focus of the question, are transactional in the sense that they are a one-to-one email to a user, however the email is not triggered by a specific event, but by an automated process. A user takes an action to be placed in a specific category, and transactional emails are sent to all users in that category on a specified schedule.</p>

<p>Triggered emails are fairly easy to build a UI around in Craft. Automated emails are harder, as you probably have to rely on either tasks (which can't be reliably scheduled at a specific time) or cron-jobs (which require extra steps by web developers to be setup).</p>

<h2>Sprout Email and triggered emails</h2>

<p>While the default Sprout Email Notifications are mostly User and Entry events, Sprout Email is not at all limited to User and Entry events. </p>

<p>Sprout Email has a flexible <a href="http://sprout.barrelstrengthdesign.com/craft-plugins/email/docs/notifications/custom-events" rel="noreferrer">Custom Event API</a> where you can create custom triggers for the events you need to support with as many settings as you wish to control them with. An example can be seen in Sprout Forms, which adds a trigger for <em>When a form entry is submitted</em>.</p>

<p>Sprout Email allows you to manage the Triggered Email content right in Craft alongside your other content and all the admin needs to do is select the event which should trigger them being sent.</p>

<h2>Sprout Email and automated emails</h2>

<p>You'll have to create a custom script and setup a cron to ping your script to send out emails on the schedule you require, but Sprout Email can support (and is in use for) advanced transactional campaigns that allow content editors to easily manage email content in a Craft-friendly way, and programmatically send out transactional email on a regular schedule.</p>

<p>You can programmatically trigger a Notification Email using the Sprout Email service layer. Notification Emails are sent via the <code>SproutEmail_DefaultMailerService</code> using the <code>sendNotification()</code> method:</p>

<pre><code>craft()-&gt;sproutEmail_defaultMailer-&gt;sendNotification($campaign, $object);
</code></pre>

<ul>
<li><code>$campaign</code> needs to be a <code>SproutEmail_CampaignModel</code></li>
<li><code>$object</code> is any object that you want to make available to your email templates.</li>
</ul>

<p>At some point we'll probably add additional support in Sprout Email around dynamic list management and automated emails. Right now, it's quite possible, it just requires a custom integration that fits your needs.</p>

CC BY-SA 3.0
2016-08-04T19:30:01.390Z
Amazing answer! Thanks you Ben. You are right, I was first struggling to express clearly my needs :) I will correct my question for what I say about Sprout Email :)
migmaker
CC BY-SA 3.0
2016-08-04T19:43:11.277Z
OK I am going to play more with Sprout Email to try to do my automated emails as you explain with cron job. Would you recommend this plugin for cron job tasks `https://github.com/boboldehampsink/cronjob` ? Thx.
migmaker
CC BY-SA 3.0
2016-08-04T20:35:35.713Z
I haven't used that plugin so can't speak to it. Cron jobs are fairly simple to setup directly on your server too, but the syntax can be a bit confusing and they typically require a certain level of permissions to create. Generally, once you set them up you hardly ever need to change them. You'll probably just need it to ping a custom controller you create that kicks off all of your transactional email logic.
Ben Parizek
CC BY-SA 3.0
2016-08-06T07:33:42.850Z
Ben just want to precise what you say here : `Right now, it's quite possible, it just requires a custom integration that fits your needs.` You mean it is possible to do automated emails (send emails at specific hours) with Sprout Email and without need of a cron job ?!
migmaker
CC BY-SA 3.0
2016-08-06T15:51:00.280Z
Right now, to send automated emails at specific a hours with Sprout Email you will need to setup a cron job, and have that cron job ping a custom controller that handles the logic of your situation. Sprout Email can help simplify several parts around managing the emails, but does not yet have support for setting up automated emails without additional customization.
Ben Parizek
CC BY-SA 3.0
2016-08-04T19:20:58.517Z
2016-08-04T19:20:58.517Z
Ben Parizek
<p>I am building a transactional email platform for my users.<br>
Users will subscribe to a digital program and receive daily emails depending on their profile and parameters.    </p>

<p>This email sending will be:<br>
 - time based<br>
 - and user subscription based<br>
 (and not event based)  </p>

<p>So I found these plugins:  </p>

<ul>
<li><a href="http://sprout.barrelstrengthdesign.com/craft-plugins/email" rel="nofollow">Sprout Email</a> > for marketing campaigns and email notifications triggered by events</li>
<li><a href="https://github.com/objectivehtml/Postmaster-for-Craft-CMS" rel="nofollow">Postmaster for Craft CMS</a> > looks more promising for my need but the plugin seems not maintained anymore (last commit was two years ago) </li>
</ul>

<p>So do you know another recent Craft plugin to do transactional emails?<br>
Or would you recommend another approach/idea?</p>

<plugins><emails>
How to build a transactional email platform with Craft
# How to build a transactional email platform with Craft

(Asked by: username_0 on 2016-08-04)

I am building a transactional email platform for my users.  
Users will subscribe to a digital program and receive daily emails depending on their profile and parameters.

This email sending will be:  
- time based  
- and user subscription based  
(and not event based)

So I found these plugins:

* [Sprout Email](http://sprout.barrelstrengthdesign.com/craft-plugins/email) > for marketing campaigns and email notifications triggered by events
* [Postmaster for Craft CMS](https://github.com/objectivehtml/Postmaster-for-Craft-CMS) > looks more promising for my need but the plugin seems not maintained anymore (last commit was two years ago)

So do you know another recent Craft plugin to do transactional emails?  
Or would you recommend another approach/idea?

**Tags:** plugins, emails

---

## 1 answers

### Answer by username_1 on 2016-08-04. Score: 6

This answer will focus on using Sprout Email for transactional emails.
Transactional Emails
First, a comment on semantics. I feel the question above is drawing a distinction between two types of transactional emails: triggered and automated.
Triggered emails are a one-off, context-specific email that get sent to a user when an event is triggered by a user's interaction with the application. Automated emails, which seems to be the focus of the question, are transactional in the sense that they are a one-to-one email to a user, however the email is not triggered by a specific event, but by an automated process. A user takes an action to be placed in a specific category, and transactional emails are sent to all users in that category on a specified schedule.
Triggered emails are fairly easy to build a UI around in Craft. Automated emails are harder, as you probably have to rely on either tasks (which can't be reliably scheduled at a specific time) or cron-jobs (which require extra steps by web developers to be setup).
Sprout Email and triggered emails
While the default Sprout Email Notifications are mostly User and Entry events, Sprout Email is not at all limited to User and Entry events. 
Sprout Email has a flexible Custom Event API where you can create custom triggers for the events you need to support with as many settings as you wish to control them with. An example can be seen in Sprout Forms, which adds a trigger for When a form entry is submitted.
Sprout Email allows you to manage the Triggered Email content right in Craft alongside your other content and all the admin needs to do is select the event which should trigger them being sent.
Sprout Email and automated emails
You'll have to create a custom script and setup a cron to ping your script to send out emails on the schedule you require, but Sprout Email can support (and is in use for) advanced transactional campaigns that allow content editors to easily manage email content in a Craft-friendly way, and programmatically send out transactional email on a regular schedule.
You can programmatically trigger a Notification Email using the Sprout Email service layer. Notification Emails are sent via the SproutEmail_DefaultMailerService using the sendNotification() method:
craft()->sproutEmail_defaultMailer->sendNotification($campaign, $object);


$campaign needs to be a SproutEmail_CampaignModel
$object is any object that you want to make available to your email templates.

At some point we'll probably add additional support in Sprout Email around dynamic list management and automated emails. Right now, it's quite possible, it just requires a custom integration that fits your needs.

> **Comments:**
> **username_0**: Amazing answer! Thanks you Ben. You are right, I was first struggling to express clearly my needs :) I will correct my question for what I say about Sprout Email :)  
> **username_0**: OK I am going to play more with Sprout Email to try to do my automated emails as you explain with cron job. Would you recommend this plugin for cron job tasks `https://github.com/boboldehampsink/cronjob` ? Thx.  
> **username_1**: I haven't used that plugin so can't speak to it. Cron jobs are fairly simple to setup directly on your server too, but the syntax can be a bit confusing and they typically require a certain level of permissions to create. Generally, once you set them up you hardly ever need to change them. You'll probably just need it to ping a custom controller you create that kicks off all of your transactional email logic.  
> **username_0**: Ben just want to precise what you say here : `Right now, it's quite possible, it just requires a custom integration that fits your needs.` You mean it is possible to do automated emails (send emails at specific hours) with Sprout Email and without need of a cron job ?!  
> **username_1**: Right now, to send automated emails at specific a hours with Sprout Email you will need to setup a cron job, and have that cron job ping a custom controller that handles the logic of your situation. Sprout Email can help simplify several parts around managing the emails, but does not yet have support for setting up automated emails without additional customization.  

---

