WordPress + MailKite
WordPress powers 43%+ of the web. Point it at MailKite and every notification, password reset, and form submission goes out over your own DKIM-signed domain — no SMTP plugin fees, no third-party email service.
What you need
- A verified domain with SPF + DKIM published
- Your API key (
mk_live_…) - WP Mail SMTP plugin (free, 4M+ installs) — or direct PHPMailer config
Option A: WP Mail SMTP plugin (recommended)
Install and activate WP Mail SMTP. Go to WP Mail SMTP → Settings and configure:
| From Email | hello@yourdomain.com (on a verified domain) |
| From Name | Your site name |
| Mailer | Other SMTP |
| SMTP Host | smtp.mailkite.dev |
| Encryption | TLS |
| SMTP Port | 587 |
| SMTP Username | mailkite |
| SMTP Password | Your API key (mk_live_…) |
Or add these constants to wp-config.php to skip the UI:
// 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', 'hello@yourdomain.com');
define('WPMAILSMTP_FROM_NAME', 'Your Site');
define('WPMAILSMTP_SET_RETURNPATH', 'false'); Option B: PHPMailer directly
If you prefer not to use a plugin, hook PHPMailer in functions.php:
// functions.php — for sites that bypass WP Mail SMTP
add_action('phpmailer_init', function ($phpmailer) {
$phpmailer->isSMTP();
$phpmailer->Host = 'smtp.mailkite.dev';
$phpmailer->Port = '587';
$phpmailer->SMTPSecure = 'tls';
$phpmailer->Username = 'mailkite';
$phpmailer->Password = getenv('MK_API_KEY');
$phpmailer->setFrom('hello@yourdomain.com', 'Your Site');
});
// Also force wp_mail to use PHPMailer's SMTP config
add_filter('wp_mail_smtp_use_phpmailer', '__return_true'); # .env (or wp-config.php via getenv)
MK_API_KEY=mk_live_your_key_here
MK_WEBHOOK_SECRET=your_webhook_secret Test it
WP Mail SMTP has a built-in Email Test tab. Or use WP-CLI:
wp eval 'mail("you@yourdomain.com", "Test from MailKite", "It works!");' Receive inbound email (optional)
MailKite can also receive email at any address on your domain and POST it to a webhook. If you want WordPress to process inbound email — for example, to create posts from email or power a support inbox — create a webhook endpoint:
<?php
// wp-content/themes/your-theme/webhook.php
// Inbound email webhook handler for MailKite
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'];
// Route to a form, support system, or post type
// Example: create a custom post type or log to a file
error_log("MailKite inbound: {$from} — {$subject}");
http_response_code(200);
echo '{"ok":true}'; Point your domain's webhook to this file and you'll receive parsed inbound email as clean JSON. See Inbound webhooks for the full payload and signature verification.
Troubleshooting
- Emails not sending — confirm the
Fromaddress is on a verified domain. Check WP Mail SMTP → Tools → Email Test. - 535 Authentication failed — your password must be your
mk_live_…API key, not a separate SMTP password. - Delayed delivery — WordPress cron (
wp-cron.php) runs on page loads. For time-critical email, disableDISABLE_WP_CRONand use a real cron job. - Plugin conflicts — WP Mail SMTP overrides
wp_mail(). If another plugin (e.g. WP HTML Mail) also hookswp_mail, one may win. Deactivate alternatives.
See the SMTP relay docs for the full connection reference, or all integrations for other platforms.