trim($_POST['sendgrid_api_key'] ?? ''), 'from_email' => trim($_POST['from_email'] ?? ''), 'from_name' => trim($_POST['from_name'] ?? '') ]); setFlash('success', 'SendGrid settings updated'); } if ($section === 'notifications') { setSetting('email_notifications', [ 'order_confirmation' => isset($_POST['notif_order_confirmation']), 'order_shipped' => isset($_POST['notif_order_shipped']), 'order_delivered' => isset($_POST['notif_order_delivered']), 'abandoned_cart' => isset($_POST['notif_abandoned_cart']), 'low_stock' => isset($_POST['notif_low_stock']), 'admin_new_order' => isset($_POST['notif_admin_new_order']), 'admin_email' => trim($_POST['admin_email'] ?? '') ]); setFlash('success', 'Notification settings updated'); } if ($section === 'test') { $testEmail = trim($_POST['test_email'] ?? ''); if ($testEmail && filter_var($testEmail, FILTER_VALIDATE_EMAIL)) { $sent = sendEmail($testEmail, 'Test Email from Tom\'s Java Jive', '

Test Email

If you received this, your email settings are working correctly!

' ); if ($sent) { setFlash('success', 'Test email sent to ' . $testEmail); } else { setFlash('error', 'Failed to send test email. Check your SendGrid settings.'); } } } header('Location: /admin/emails.php'); exit; } $sendgrid = getSetting('email_sendgrid', [ 'api_key' => '', 'from_email' => '', 'from_name' => "Tom's Java Jive" ]); $notifications = getSetting('email_notifications', [ 'order_confirmation' => true, 'order_shipped' => true, 'order_delivered' => true, 'abandoned_cart' => false, 'low_stock' => true, 'admin_new_order' => true, 'admin_email' => '' ]); ?>

SendGrid Configuration

Get this from SendGrid Dashboard

Email Notifications

Customer Notifications


Admin Notifications

Test Email