I'm having trouble sending order notification emails to anonymous users. As a bare-bones test I have created a new rule which triggers on 'Completing the checkout process', checks if the current user is authenticated, and if not sends an email to [commerce-order:mail]. When it's triggered I get the following error message, suggesting it is not able to get the email address from the order.
Error sending e-mail (from [email protected] to ).
I'm fairly sure the problem isn't to do with Rules config as it's so simple, but here is the export anyway:
{ "rules_anonymous_order_notification" : {
"LABEL" : "Anonymous Order Notification",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "Commerce Checkout" ],
"REQUIRES" : [ "rules", "commerce_checkout" ],
"ON" : { "commerce_checkout_complete" : [] },
"IF" : [
{ "NOT user_has_role" : {
"account" : [ "site:current-user" ],
"roles" : { "value" : { "2" : "2" } }
}
}
],
"DO" : [
{ "mail" : {
"to" : [ "commerce-order:mail" ],
"subject" : "Order received!",
"message" : "This is to tell you the order has been received.",
"language" : [ "commerce-order:state" ]
}
}
]
} }
What else could be causing this?
EDIT: I've just noticed in the db the mail column is empty for anonymous orders in 'commerce_order' - is this normal?
commerce order
will use the mail associated with the user account.