Worker Mailer is an SMTP client that runs on Cloudflare Workers. It leverages [Cloudflare TCP Sockets](https://developers.cloudflare.com/workers/runtime-apis/tcp-sockets/) and doesn't rely on any other dependencies.
MIT License
Worker Mailer is an SMTP client that runs on Cloudflare Workers. It leverages Cloudflare TCP Sockets and doesn't rely on any other dependencies.
plain
, login
, and CRAM-MD5
SMTP authenticationnpm i worker-mailer@beta
In your wrangler.toml
, configure the following:
compatibility_flags = ["nodejs_compat"]
import { WorkerMailer } from 'worker-mailer'
const mailer = await WorkerMailer.connect({
credentials: {
username: '[email protected]',
password: 'password',
},
authType: 'plain',
host: 'smtp.acme.com',
port: 587,
secure: true,
})
await mailer.send({
from: { name: 'Bob', email: '[email protected]' },
// from: '[email protected]'
subject: 'Test email',
text: 'Plain message',
// html: '<p>HTML message</p>',
to: { name: 'Alice', email: '[email protected]' },
// to: [{ name: 'Alice', email: '[email protected]' }, { name: 'Sam', email: '[email protected]' }]
// to: '[email protected]'
})
For more API details, check out the TypeScript declaration file dist/index.d.ts
.
We welcome your contributions! If you encounter any issues or have suggestions while using this library, feel free to open an issue on our GitHub repository.