Hi,
I try to send an email using a HTML template but Kirby doesn’t find my template:
Error message Undefined variable: The email template "ads" cannot be found
I created a html template “ads”: site/templates/emails/ads.html.php
And this is my code to send the email:
$ad_date_formatted = date( "Y-m-d" , '1553558400');
try {
$kirby->email([
'from' => 'support@thewhale.cc',
'replyTo' => 'no-reply@thewhale.cc',
'to' => 'gillesvauvarin@gmail.com',
'subject' => 'The whale - Your Ad has been booked on',
'template' => 'ads',
'data' => [
'ad_date_booked' => date( "Y-m-d" , 1553558400 ),
'ad_date_stop' => date( "Y-m-d" , ( strtotime( $ad_date_formatted . ' - 5 days' ) ) ),
'ad_id' => 'id_xxxxxxxx',
'ad_price' => '$50',
'ad_product_label' => 'Sponsor Ads'
]
]);
} catch ( Exception $error_mail ) {
$email_catch_msg = 'Ad booking. Email sending failed: ' . $error_mail->getMessage();
echo $email_catch_msg;
}
Did I miss something or is it a bug?