Cloudflare Workers Code Error:

Support, What is the source of the Cloudflare Workers Code Error: "Failed to deliver email: SMTPClient is not defined", { "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 } Regards, Hal DevCED Team
11 Replies
Chaika
Chaika12mo ago
What is the source of the Cloudflare Workers Code Error: "Failed to deliver email: SMTPClient is not defined",
Just generic javascript errors: not defined: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Not_defined not a function: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Not_a_function
MDN Web Docs
ReferenceError: "x" is not defined - JavaScript | MDN
The JavaScript exception "variable is not defined" occurs when there is a non-existent variable referenced somewhere.
MDN Web Docs
TypeError: "x" is not a function - JavaScript | MDN
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value is not actually a function.
Chaika
Chaika12mo ago
(Something wrong with your code)
CFORED
CFORED12mo ago
What is the name of the SMTP client library installed on Cloudflare Workers, e.g., include libraries like nodemailer, emailjs-smtp-client, or others. See error message: Uncaught Error: No such module "nodemailer". imported from "worker.js" (Code: 10021).
Chaika
Chaika12mo ago
There is no smtp client libraries installed on Workers. There is no libraries preinstalled at all. Workers run as V8 Isolates - same javascript engine as Chrome, web-like environment. There is TCP Connections supported via a custom interface (https://developers.cloudflare.com/workers/runtime-apis/tcp-sockets/) , but smtp (25) is banned, and none of those libraries will use it/work by default (and would probably require pretty major changes to work) Any library you use would be bundled into the worker.js itself, wrangler uses esbuild by default. That doesn't mean the library will work though, espec ones that depend on nodejs libraries. There is a bit of nodejs compat you can enable, but if your end goal is to connect to another smtp server to deliver an email, that's not going to work with port 25 banned and those libraries all depending on nodejs sockets/network. If you can't message.forward()/it doesn't fit your use case, next best bet would be using a mail solution like mailgun or ses who has an HTTP API you can fetch and use to send whatever you wish
CFORED
CFORED12mo ago
Hi , We have a cPanel/EXIM mail client and smart host Dual Circle that uses port no. 10025, smtp mx mail socket. The problem is with the SMTP node mailer library: Uncaught ReferenceError: require is not defined at worker.js:2:20 (Code: 10021). Regards, Harold, DevCED Team Hi, We have a cPanel/EXIM mail client and smart host Dual Circle that uses port no. 10025, smtp mx mail socket. The problem is with the SMTP node mailer library: Uncaught ReferenceError: require is not defined at worker.js:2:20 (Code: 10021). Regards, Harold, DevCED Team
Cyb3r-Jak3
Cyb3r-Jak312mo ago
This sounds like a bundling issue with your worker
CFORED
CFORED12mo ago
How do I resolve the bundling error?
Cyb3r-Jak3
Cyb3r-Jak312mo ago
What does your code look like?
CFORED
CFORED12mo ago
Gist
Cloudflare Worker | EXIM Mail Server
Cloudflare Worker | EXIM Mail Server. GitHub Gist: instantly share code, notes, and snippets.
Cyb3r-Jak3
Cyb3r-Jak312mo ago
The error in the gist is showing an invalid SSL error no Reference Error
CFORED
CFORED12mo ago
We found an issue with Auto SSL. Thanks
Want results from more Discord servers?
Add your server