Email Service - Threaded replies now possible in Email Workers
1y ago
Source
CloudflareEmail Service - Threaded replies now possible in Email Workerscloudflare.comWe’re removing some of the restrictions in Email Routing so that AI Agents and task automation can better handle email workflows, including how Workers can reply to incoming emails. It's now possible to keep a threaded email conversation with an Email Worker script as long as: The incoming email has to have valid DMARC . The email can only be replied to once in the same EmailMessage event. The recipient in the reply must match the incoming sender. The outgoing sender domain must match the same domain that received the email. Every time an email passes through Email Routing or another MTA, an entry is added to the References list. We stop accepting replies to emails with more than 100 References entries to prevent abuse or accidental loops. Here's an example of a Worker responding to Emails using a Workers AI model: import PostalMime from "postal-mime" ; import { createMimeMessage } from "mimetext" ; import { EmailMessage } from "cloudflare:email" ; export default { async email ( message , env , ctx ) { const email = await PostalMime . parse ( message . raw ) ; const res = await env . AI . run ( "@cf/meta/llama-2-7b-chat-fp16" , { messages : [ { role : "user" , content : email . text ?? "" , }, ] , } ) ; // message-id is generated by mimetext const response = createMimeMessage () ; response . setHeader ( "In-Reply-To" , message . headers . get ( "Message-ID" ) ! ) ; response . setSender ( "[email protected]" ) ; response . setRecipient ( message . from ) ; response . setSubject ( "Llama response" ) ; response . addMessage ( { contentType : "text/plain" , data : res instanceof ReadableStream ? await new Response ( res ) . text () : res . response ! , } ) ; const replyMessage = new EmailMessage ( "" , message . from , response . asRaw () , ) ; await message . reply ( replyMessage ) ; }, } satisfies ExportedHandler < Env >; See Reply to emails from Workers for more information.
You might also wanna read
Show HN: E2a – Open-source email gateway for AI agents
github.com·1mo ago
AgentMail: Dedicated Email Inboxes for AI Agents
AgentMail is a service that provides dedicated email inboxes for AI agents, enabling them to autonomously send, receive, thread, and reply t
Fluxmail launches AI-powered email assistant for Gmail with thread summarization and smart replies
Fluxmail is an AI-powered email client designed to help founders and operators manage their Gmail inbox more efficiently. Built by maker Ric

Google's AI Inbox for Gmail: Early Review of AI-Powered Email Management
Google has introduced an AI Inbox feature for Gmail that replaces the traditional email list with AI-generated to-dos and topics based on in
MailMolt: Dedicated Email Addresses for AI Agents with Human Oversight
MailMolt offers a service that provides AI agents with their own dedicated email addresses instead of giving them access to human users' per
Deliveryman.ai automates cold email infrastructure setup and deliverability management
Deliveryman.ai is a cold email infrastructure automation tool that handles mailbox setup, DNS configuration (SPF, DKIM, DMARC), sender reput

Comments
Sign in to join the conversation.
No comments yet. Be the first.