Slack + MailKite
Slack is where teams communicate. Use MailKite to forward inbound email as Slack messages — support requests, notifications, and alerts appear in the right channel instantly.
What you need
- A verified domain with SPF + DKIM published
- Your API key (
mk_live_…) - Slack workspace with an Incoming Webhook or Bot Token
How it works
MailKite POSTs inbound email to a webhook handler that sends a Slack message via the Incoming Webhook URL or Bot API. The message uses Slack Block Kit for rich formatting — subject as the header, sender/recipient as fields, and the body as the main content.
Set up the webhook
Deploy this handler as a serverless function or worker. It formats inbound email as a Slack Block Kit message and posts it to your channel. Set SLACK_WEBHOOK_URL as an environment variable.
// Slack inbound email → channel message handler
async function handleInbound(email) {
const webhookUrl = process.env.SLACK_WEBHOOK_URL;
const message = {
blocks: [
{
type: 'header',
text: { type: 'plain_text', text: `📧 ${email.subject || 'New inbound email'}` },
},
{
type: 'section',
fields: [
{ type: 'mrkdwn', text: `*From:*
${email.from}` },
{ type: 'mrkdwn', text: `*To:*
${email.to}` },
],
},
{
type: 'section',
text: { type: 'mrkdwn', text: email.text?.substring(0, 2000) || '_No body_' },
},
],
};
const res = await fetch(webhookUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(message),
});
return res.json();
} Receive inbound email
Configure your MailKite domain's webhook URL to point at your handler. Every inbound email delivers this payload:
from— sender addressto— recipient addresssubject— email subjecttext— plain text bodyhtml— HTML bodyattachments— array of file objects
Test it
curl -X POST https://your-worker.example.com/mailkite-inbound \
-H "Content-Type: application/json" \
-d '{"from":"customer@example.com","to":"support@yourdomain.com","subject":"Need help","text":"My order #1234 is late."}' Troubleshooting
- Create an Incoming Webhook at api.slack.com/apps → your app → Incoming Webhooks; select the target channel.
- Slack webhooks accept a max of 3000 characters — the handler truncates long email bodies automatically.
- If the webhook URL is invalid, Slack returns a 404 — check the URL in your environment variables.
See the SMTP relay docs for connection details, or Inbound webhooks for the full payload.