<p>This was related to the email template. The template includes <code>{% set number = craft.request.param('number') %}</code>. .param('number') does not exist in the context of checkout. This means the order doesn't exist and the page redirects to commerce/customer which makes no sense when it comes to email. So no email.</p>

<p>Commenting out or removing <code>{% set number = craft.request.param('number') %}</code> solves the problem.</p>

<p>Thanks to P &amp; T support for the answer. And to Jeremy Daalder for his help.</p>

CC BY-SA 3.0
2016-03-23T00:37:02.683Z
I think you missed this in my comment above: "If there are issues with your email template being parsed, you'd see those in commerce.log"

...that's the take home point for people trying to self diagnose this issue in the future - if there's problems parsing your email template, that's where they appear.  If you'd look in there, you can find these issues quickly.
Jeremy Daalder
CC BY-SA 3.0
2016-03-23T14:58:50.263Z
I'm uncertain if this would actually be recorded in the logs. The parsing appeared to be fine and the system went through the motions without a clear error (order doesn't exist > redirect > no need to send email).

Checking the logs (and I don't pretend to be an expert here), there isn't anything there that would help in this case. From what I can see, the template is named in the error (e.g. Twig_Environment->render('templatename', Array) but the template in question isn't listed in the log.
Wonko
CC BY-SA 3.0
2016-03-22T00:32:22.220Z
2016-03-22T00:32:22.220Z
Wonko
<p>The error is not telling you that the email <em>address</em> is missing, I think, but rather that the <em>email itself</em> to send is missing.  </p>

<p>Have you assigned an actual email to send for that particular status?</p>

<p><em>Commerce->Settings->Order Statuses</em> - check the column 'Has Emails' has a value of 1 or more in it.  </p>

<p>(To actually assign one, create it first in the email section, and then in this section click on the order status and in the bottom field 'Status Emails' you'll then be able to choose your created email).</p>

<p>Based on the error and the code generating it (in Commerce_OrderStatusesService.php) - I would say you've set up a status but not actually assigned the email you've made to it.</p>

CC BY-SA 3.0
2016-03-19T04:51:56.010Z
Thanks for this. Unfortunately, the email is assigned to the status. Sorry for the confusion. Looking back, this error occurred before I did exactly what you're suggesting. Now, the error no longer appears but emails still aren't going out.
Wonko
CC BY-SA 3.0
2016-03-19T05:51:56.947Z
Ok, well if you're not getting that error anymore, then it points to an email deliverability problem.  As in, it's most likely they are going out, but they're not getting through to the recipient email. If there are issues with your email template being parsed, you'd see those in commerce.log, but assuming it is not that, then I'd day you need to look at your email setup.  Are you using phpmail, or smtp, or (best option) a transactional email service like e.g. Mandrill, mailgun, sparkpost etc.?
Jeremy Daalder
CC BY-SA 3.0
2016-03-19T11:25:48.687Z
I'm pretty sure they're not going out at all. I sent a couple of test emails and then executed a couple of dummy transactions. Then I contacted the host to see what was actual sent. They only have a record of the test emails going out. I'm using SMTP email but I'll look into a transactional service.
Wonko
CC BY-SA 3.0
2016-03-18T21:18:18.573Z
2016-03-18T21:18:18.573Z
Jeremy Daalder
<p>Folks:</p>

<p>I'm wondering if this is a bug or something else. Essentially, test emails from the system work fine but emails that are supposed to be sent when the order moves to "Processing" do not. The log file from yesterday states: <code>2016/03/17 14:31:52 [info] [plugin] [Forced] Can't send email if no status or emails exist.</code></p>

<p>But there is a status (processing) and an email for that status (<code>{{ order.email }}</code>). I have attempted several dummy transactions today as well but the emails don't come through and the logs don't update either. And no, there's nothing in the spam folder. Or error messages sent back to the host.</p>

<p>I even tried to have the order emails sent to a specific email address instead of <code>{{ order.email }}</code>. No joy.</p>

<p>Finally, I am using the default commerce templates so I'm pretty sure the issue isn't there.</p>

<p>Does anyone have any ideas?</p>

<plugin-craftcommerce>
Emails not being sent when transaction complete
# Emails not being sent when transaction complete

(Asked by: username_0 on 2016-03-18)

Folks:

I'm wondering if this is a bug or something else. Essentially, test emails from the system work fine but emails that are supposed to be sent when the order moves to "Processing" do not. The log file from yesterday states: `2016/03/17 14:31:52 [info] [plugin] [Forced] Can't send email if no status or emails exist.`

But there is a status (processing) and an email for that status (`{{ order.email }}`). I have attempted several dummy transactions today as well but the emails don't come through and the logs don't update either. And no, there's nothing in the spam folder. Or error messages sent back to the host.

I even tried to have the order emails sent to a specific email address instead of `{{ order.email }}`. No joy.

Finally, I am using the default commerce templates so I'm pretty sure the issue isn't there.

Does anyone have any ideas?

**Tags:** plugin-craftcommerce

---

## 2 answers

### Answer by username_0 on 2016-03-22. Score: 0 | Accepted answer

This was related to the email template. The template includes `{% set number = craft.request.param('number') %}`. .param('number') does not exist in the context of checkout. This means the order doesn't exist and the page redirects to commerce/customer which makes no sense when it comes to email. So no email.

Commenting out or removing `{% set number = craft.request.param('number') %}` solves the problem.

Thanks to P & T support for the answer. And to Jeremy Daalder for his help.

> **Comments:**
> **username_1**: I think you missed this in my comment above: "If there are issues with your email template being parsed, you'd see those in commerce.log"  ...that's the take home point for people trying to self diagnose this issue in the future - if there's problems parsing your email template, that's where they appear.  If you'd look in there, you can find these issues quickly.  
> **username_0**: I'm uncertain if this would actually be recorded in the logs. The parsing appeared to be fine and the system went through the motions without a clear error (order doesn't exist > redirect > no need to send email).  Checking the logs (and I don't pretend to be an expert here), there isn't anything there that would help in this case. From what I can see, the template is named in the error (e.g. Twig_Environment->render('templatename', Array) but the template in question isn't listed in the log.  

---

### Answer by username_1 on 2016-03-18. Score: 2

The error is not telling you that the email *address* is missing, I think, but rather that the *email itself* to send is missing.

Have you assigned an actual email to send for that particular status?

*Commerce->Settings->Order Statuses* - check the column 'Has Emails' has a value of 1 or more in it.

(To actually assign one, create it first in the email section, and then in this section click on the order status and in the bottom field 'Status Emails' you'll then be able to choose your created email).

Based on the error and the code generating it (in Commerce\_OrderStatusesService.php) - I would say you've set up a status but not actually assigned the email you've made to it.

> **Comments:**
> **username_0**: Thanks for this. Unfortunately, the email is assigned to the status. Sorry for the confusion. Looking back, this error occurred before I did exactly what you're suggesting. Now, the error no longer appears but emails still aren't going out.  
> **username_1**: Ok, well if you're not getting that error anymore, then it points to an email deliverability problem.  As in, it's most likely they are going out, but they're not getting through to the recipient email. If there are issues with your email template being parsed, you'd see those in commerce.log, but assuming it is not that, then I'd day you need to look at your email setup.  Are you using phpmail, or smtp, or (best option) a transactional email service like e.g. Mandrill, mailgun, sparkpost etc.?  
> **username_0**: I'm pretty sure they're not going out at all. I sent a couple of test emails and then executed a couple of dummy transactions. Then I contacted the host to see what was actual sent. They only have a record of the test emails going out. I'm using SMTP email but I'll look into a transactional service.  

---

