WooCommerce + MailKite
WooCommerce sends order confirmations, shipping updates, and password resets
through WordPress's wp_mail(). Point that at MailKite and every
store email goes out DKIM-signed from your own domain — no transactional email
service needed.
What you need
- A verified domain with SPF + DKIM published
- Your API key (
mk_live_…) - WP Mail SMTP plugin (free, 4M+ installs)
- WooCommerce (any version)
Configure WP Mail SMTP
WooCommerce uses WordPress's built-in wp_mail(). WP Mail SMTP
overrides that function to route everything through MailKite. Install and
activate the plugin, then configure:
| From Email | orders@yourdomain.com (on a verified domain) |
| From Name | Your store name |
| Mailer | Other SMTP |
| SMTP Host | smtp.mailkite.dev |
| Encryption | TLS |
| SMTP Port | 587 |
| SMTP Username | mailkite |
| SMTP Password | Your API key (mk_live_…) |
// wp-config.php — or paste into WP Mail SMTP settings UI
define('WPMAILSMTP_MAILER', 'other');
define('WPMAILSMTP_HOST', 'smtp.mailkite.dev');
define('WPMAILSMTP_PORT', '587');
define('WPMAILSMTP_ENCRYPTION', 'tls');
define('WPMAILSMTP_USERNAME', 'mailkite');
define('WPMAILSMTP_PASSWORD', 'mk_live_...');
define('WPMAILSMTP_FROM_EMAIL', 'orders@yourdomain.com');
define('WPMAILSMTP_FROM_NAME', 'Your Store'); Customize WooCommerce emails
WooCommerce hooks into wp_mail() automatically. You can customize
the From address, add reply-to headers, and tweak templates in
WooCommerce → Settings → Emails. To set a reply-to on specific
emails, hook woocommerce_email_headers:
// functions.php — hook into WooCommerce email headers
add_action('woocommerce_email_headers', function ($headers, $email_id, $order) {
if ($email_id === 'customer_processing_order') {
$headers .= 'Reply-To: support@yourdomain.com' . "\r\n";
}
return $headers;
}, 10, 3);
// Force WooCommerce to use the site's wp_mail (which WP Mail SMTP hooks)
// This is default behavior — listed here for clarity. Receive customer replies
When a customer replies to an order confirmation, MailKite can POST the reply to your webhook and you can add it as an order note. Set your domain's webhook endpoint to a handler like this:
<?php
// Process inbound email replies to order notifications
// Receives MailKite webhook → creates order note in WooCommerce
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(405);
exit;
}
$payload = json_decode(file_get_contents('php://input'), true);
// Verify signature
$sig = $_SERVER['HTTP_X_MAILKITE_SIGNATURE'] ?? '';
$secret = getenv('MK_WEBHOOK_SECRET');
$computed = hash_hmac('sha256', json_encode($payload), $secret);
if (!hash_equals($computed, $sig)) {
http_response_code(401);
exit;
}
$from = $payload['from'];
$subject = $payload['subject'];
$text = $payload['text'];
// Find the order by email subject (e.g. "Re: Order #1234")
if (preg_match('/Order #(\d+)/', $subject, $m)) {
$order_id = (int) $m[1];
$order = wc_get_order($order_id);
if ($order) {
$order->add_order_note("Customer reply from {$from}:\n\n{$text}");
}
}
http_response_code(200);
echo '{"ok":true}'; This extracts the order number from the subject line and adds the customer's reply as a WooCommerce order note — visible in the admin panel.
Which emails are affected?
WP Mail SMTP intercepts every call to wp_mail()
on the site — WooCommerce order emails, WordPress password resets, plugin
notifications, and form submissions. All go through MailKite.
Troubleshooting
- Order emails not sending — confirm the
Fromaddress is on a verified domain. Check WooCommerce → Settings → Emails → manage each email type. - Wrong sender domain — WooCommerce defaults to
WordPress <woocommerce@yoursite.com>. Override in WP Mail SMTP settings or set theFrom Emailthere. - Plugin conflicts — if you use WooCommerce MailChimp, Klaviyo, or another email plugin, it may hook
wp_mailtoo. One hook wins; deactivate the one you don't need. - Transactional vs marketing — order confirmations are transactional (they go through MailKite). Marketing emails (campaigns, promotions) should go through your email marketing tool, not MailKite.
See the SMTP relay docs for the full connection reference, or WordPress for more general WordPress + MailKite setup.