Exim Mail Server


Other than enabling an enterprise account Spectrum application, is there a secondary tool to move email traffic from Cloudflare Works to my Exim mail server (imap.xxxx.com:10025)?

DevCED Team

Cloudflare Workers do not accept SMTP connections. You will need to explain what you hope to accomplish in greater detail to obtain a more complete answer.

Cloudflare Works produces the following error message, application to move email messages from Email Worker to our inbound SMTP Exmail mail server:

How do we transport email messages from Email Works to our inbound SMTP Exim mail server?

Is Spectrum application, the only solution to move email traffic from Email Workers to our inbound SMTP EXIM mail mail server?

Tail the Worker for more information about why it is failing:

1 Like

Here are the Wrangler Stream Logs:

“outcome”: “exception”,
“scriptName”: “imap-xxxx-com”,
“diagnosticsChannelEvents”: ,
“exceptions”: [
“name”: “TypeError”,
“message”: “message.pipeTo is not a function”,
“timestamp”: 1699457925817
“logs”: ,
“eventTimestamp”: 1699457925810,
“event”: {
“rawSize”: 27979,
“rcptTo”: “[email protected]”,
“mailFrom”: “AGq3uJNyDTtS0WcvYtxsQRA==_1102324222837_rYV3DpwbEe2Nu/[email protected]
“id”: 2

Here is the index.js file:

export default {
async email(message, env, ctx) {
try {
* Route all email traffic to xxxx.mx.xxxx.org:10025

  // Define the SMTP server and port
  const smtpServer = "xxxx.mx.xxxx.org";
  const smtpPort = 10025;

  // Create a TCP connection to the SMTP server
  const { socket, connect } = new SMTPClient({
    host: smtpServer,
    port: smtpPort,

  // Connect to the SMTP server
  await connect();

  // Send the email message to the SMTP server
  const success = await socket.send(message.body);

  // Check if the email was successfully delivered
  if (!success) {
    // Handle the error
    throw new Error('Failed to deliver email to SMTP server');

  // Close the connection to the SMTP server
  await socket.quit();
} catch (error) {
  // Handle any errors that occur during the email delivery
  throw new Error('Failed to deliver email: ' + error.message);


Why does the index.js not transport email messages from Cloud Workers to my SMTP mail server?

DevCED Team