Merx

Sending Emails

You may want to send a confirmation mail to your customer. You can use hooks to send mails. Read Kirby’s guide about emails to learn more of its power.

site/config.php

sendConfirmationMail($orderPage) {
  $kirby->email([
    'from' => 'info@my-shop.com',
    'to' => (string)$orderPage->email(),
    'subject' => 'Thank’s for your order!',
    'body'=> 'Dear ' . $orderPage->name() ', you payed ' formatPrice($orderPage->cart()->getSum()),
  ]);
}

return [
  'hooks' => [
    'ww.merx.completePayment:after' => function ($orderPage, $data, $gateway) {
      sendConfirmationMail($orderPage);
    },
  ],
];