0

Is it possible to supply dynamic BCC's on Exp:resso store order confirmation emails?

I have an ecommerce site that tutors can list courses on, and students can buy courses. When a course is purchased the student gets an email, but I need to notify the tutor too (which is an EE member).

I have got as far as writing an extension that taps into store_order_complete_end, which means I have access to the Store\Model\Order and Store\Model\Email objects... but I'm not sure what to do from there. Thanks.

1

Oh it appears it is very straightforward. So in the extension grab the store emails (I'm just getting all for development) then you can set the BCC attribute as per below.

$emails = Store\Model\Email::whereIn('id', [1])->where('enabled', 1)->get();
foreach ($emails as $email) {
    # For my IDE
    $email instanceof Store\Model\Email;
    $email->setAttribute("bcc", "myaddress@mydomain.com");
    $sent = ee()->store->email->send($email, $order);
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.