Reminder email

This commit is contained in:
Chris Smith
2019-05-01 16:43:50 -05:00
parent 547ea1bf91
commit 251aa5f40a
2 changed files with 28 additions and 0 deletions

View File

@@ -115,6 +115,33 @@ $router->get('/admin/order/{id}', function ($id) {
include 'views/common/footer.php'; include 'views/common/footer.php';
}); });
$router->get('/admin/reminder-email', function () {
$orders = R::findAll('orders');
$client = new Postmark\PostmarkClient($_SERVER['POSTMARK_API_KEY']);
foreach ($orders as $order) {
$client->sendEmailWithTemplate(
$_SERVER['POSTMARK_FROM'],
$order->email,
$_SERVER['POSTMARK_REMINDER_TEMPLATE'],
[
'name' => $order->first_name,
'product_name' => 'Dinner in the Woods ' . date('Y'),
'action_manage_guests_url' => 'https://' . $_SERVER['manage-url'] . $order->uuid,
],
true, //inline css
null, //tag
true, //track opens
null, //reply to
null //cc
);
}
include 'views/common/head.php';
include 'views/admin-order-details.php';
include 'views/common/footer.php';
});
$router->post('/admin/order/{id}', function ($id) { $router->post('/admin/order/{id}', function ($id) {
$order = R::load('orders', $id); $order = R::load('orders', $id);
$parametersToSearch = $_POST['guestsArray']; $parametersToSearch = $_POST['guestsArray'];

View File

@@ -13,6 +13,7 @@ DB_USER="root"
DB_PASS="root" DB_PASS="root"
POSTMARK_API_KEY="special" POSTMARK_API_KEY="special"
POSTMARK_TEMPLATE="identifier_for_template" POSTMARK_TEMPLATE="identifier_for_template"
POSTMARK_REMINDER_TEMPLATE="identifier_for_reminder_template"
POSTMARK_GUEST_TEMPLATE="identifier_for_template" POSTMARK_GUEST_TEMPLATE="identifier_for_template"
POSTMARK_FROM="sender@email.com" POSTMARK_FROM="sender@email.com"
STRIPE_API_SECRET_KEY="sk" STRIPE_API_SECRET_KEY="sk"