SMTP at 40: Email Delivery Still Matters
SMTP turns 40 this year, but it remains the backbone of critical business communication. From account verification to feature announcements, email is still how most companies reach their users. The technical act of sending a message is trivial—the hard part is getting it delivered. Spam filters and domain reputation systems make new senders inherently suspect.
Cloudflare has partnered with MailChannels to address this friction directly. Their service, built specifically for Workers, eliminates the usual setup overhead: no domain validation, no separate account creation. MailChannels applies spam filtering before messages go out, protecting your domain reputation even when email content includes user-submitted data. The service is free to use.
MailChannels CEO Ken Simpson: "Cloudflare Workers and Pages are changing the game when it comes to ease of use and removing friction to get started. So when we sat down to see what friction we could remove from sending out emails, it turns out that with our incredible anti-spam and anti-phishing, the answer is 'everything'. We can't wait to see what applications the community is going to build on top of this."
The current limitation is that requests must originate from a Cloudflare IP address. Local development and build server testing won't work yet.
Sending Your First Email from a Worker
A minimal Worker script is all it takes to send a message:
export default {
async fetch(request) {
send_request = new Request('https://api.mailchannels.net/tx/v1/send', {
method: 'POST',
headers: {
'content-type': 'application/json',
},
body: JSON.stringify({
personalizations: [
{
to: [{ email: '[email protected]', name: 'Test Recipient' }],
},
],
from: {
email: '[email protected]',
name: 'Workers - MailChannels integration',
},
subject: 'Look! No servers',
content: [
{
type: 'text/plain',
value: 'And no email service accounts and all for free too!',
},
],
}),
})
},
}
That script can be adapted to send any email content you need.
Contact Forms Without Exposing Your Address
The same integration powers static form handling through the Pages Plugin Framework. Adding the snippet below to your /functions/_middleware.ts file means any form carrying the data-static-form-name attribute will automatically email its submissions to you.
import mailchannelsPlugin from "@cloudflare/pages-plugin-mailchannels";
export const onRequest = mailchannelsPlugin({
personalizations: [
{
to: [{ name: "ACME Support", email: "[email protected]" }],
},
],
from: { name: "Enquiry", email: "[email protected]" },
respondWith: () =>
new Response(null, {
status: 302,
headers: { Location: "/thank-you" },
}),
});
The actual HTML form can be as simple or complex as needed—the only requirement is that data-static-form-name attribute, whose value can be anything you choose to distinguish between forms.
<!DOCTYPE html>
<html>
<body>
<h1>Contact</h1>
<form data-static-form-name="contact">
<div>
<label>Name<input type="text" name="name" /></label>
</div>
<div>
<label>Email<input type="email" name="email" /></label>
</div>
<div>
<label>Message<textarea name="message"></textarea></label>
</div>
<button type="submit">Send!</button>
</form>
</body>
</html>
There is no remaining barrier to email delivery from Workers or Pages. Copy either snippet into your project and start sending messages immediately, at no cost.



