@workermailer/smtp 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/dist/queue.d.mts +3 -3
- package/dist/queue.d.ts +3 -3
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ Worker Mailer is an SMTP client that runs on Cloudflare Workers. It leverages [C
|
|
|
36
36
|
## Installation
|
|
37
37
|
|
|
38
38
|
```shell
|
|
39
|
-
npm i @
|
|
39
|
+
npm i @workermailer/smtp
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
## Quick Start
|
|
@@ -51,7 +51,7 @@ compatibility_flags = ["nodejs_compat"]
|
|
|
51
51
|
2. Use in your code:
|
|
52
52
|
|
|
53
53
|
```typescript
|
|
54
|
-
import { WorkerMailer } from '@
|
|
54
|
+
import { WorkerMailer } from '@workermailer/smtp'
|
|
55
55
|
|
|
56
56
|
// Connect to SMTP server
|
|
57
57
|
const mailer = await WorkerMailer.connect({
|
|
@@ -91,7 +91,7 @@ export default defineEventHandler(async event => {
|
|
|
91
91
|
return await transporter.sendMail()
|
|
92
92
|
} else {
|
|
93
93
|
// Production: Use worker-mailer in Cloudflare Workers environment
|
|
94
|
-
const { WorkerMailer } = await import('@
|
|
94
|
+
const { WorkerMailer } = await import('@workermailer/smtp')
|
|
95
95
|
const mailer = await WorkerMailer.connect()
|
|
96
96
|
return await mailer.send()
|
|
97
97
|
}
|
|
@@ -253,7 +253,7 @@ await WorkerMailer.send(
|
|
|
253
253
|
You can embed images directly in HTML emails using Content-ID (CID):
|
|
254
254
|
|
|
255
255
|
```typescript
|
|
256
|
-
import { WorkerMailer } from '@
|
|
256
|
+
import { WorkerMailer } from '@workermailer/smtp'
|
|
257
257
|
|
|
258
258
|
const mailer = await WorkerMailer.connect({
|
|
259
259
|
host: 'smtp.acme.com',
|
|
@@ -287,7 +287,7 @@ await mailer.send({
|
|
|
287
287
|
Monitor email operations with lifecycle hooks:
|
|
288
288
|
|
|
289
289
|
```typescript
|
|
290
|
-
import { WorkerMailer } from '@
|
|
290
|
+
import { WorkerMailer } from '@workermailer/smtp'
|
|
291
291
|
|
|
292
292
|
const mailer = await WorkerMailer.connect({
|
|
293
293
|
host: 'smtp.acme.com',
|
|
@@ -328,7 +328,7 @@ import {
|
|
|
328
328
|
SmtpRecipientError,
|
|
329
329
|
SmtpTimeoutError,
|
|
330
330
|
InvalidContentError,
|
|
331
|
-
} from '@
|
|
331
|
+
} from '@workermailer/smtp'
|
|
332
332
|
|
|
333
333
|
try {
|
|
334
334
|
const mailer = await WorkerMailer.connect({
|
|
@@ -382,12 +382,12 @@ max_retries = 3
|
|
|
382
382
|
2. Create your worker with queue handler:
|
|
383
383
|
|
|
384
384
|
```typescript
|
|
385
|
-
import { WorkerMailer } from '@
|
|
385
|
+
import { WorkerMailer } from '@workermailer/smtp'
|
|
386
386
|
import {
|
|
387
387
|
createQueueHandler,
|
|
388
388
|
enqueueEmail,
|
|
389
389
|
type QueueEmailMessage,
|
|
390
|
-
} from '@
|
|
390
|
+
} from '@workermailer/smtp/queue'
|
|
391
391
|
|
|
392
392
|
interface Env {
|
|
393
393
|
EMAIL_QUEUE: Queue<QueueEmailMessage>
|
|
@@ -433,7 +433,7 @@ import {
|
|
|
433
433
|
enqueueEmail,
|
|
434
434
|
enqueueEmails,
|
|
435
435
|
type QueueEmailMessage,
|
|
436
|
-
} from '@
|
|
436
|
+
} from '@workermailer/smtp/queue'
|
|
437
437
|
|
|
438
438
|
// Enqueue a single email
|
|
439
439
|
await enqueueEmail(env.EMAIL_QUEUE, {
|
package/dist/queue.d.mts
CHANGED
|
@@ -26,7 +26,7 @@ type QueueProcessResult = {
|
|
|
26
26
|
* @example
|
|
27
27
|
* ```typescript
|
|
28
28
|
* // In your worker:
|
|
29
|
-
* import { createQueueHandler } from '@
|
|
29
|
+
* import { createQueueHandler } from '@workermailer/smtp/queue'
|
|
30
30
|
*
|
|
31
31
|
* export default {
|
|
32
32
|
* async queue(batch, env, ctx) {
|
|
@@ -66,7 +66,7 @@ declare function createQueueHandler(options?: {
|
|
|
66
66
|
*
|
|
67
67
|
* @example
|
|
68
68
|
* ```typescript
|
|
69
|
-
* import { enqueueEmail } from '@
|
|
69
|
+
* import { enqueueEmail } from '@workermailer/smtp/queue'
|
|
70
70
|
*
|
|
71
71
|
* await enqueueEmail(env.EMAIL_QUEUE, {
|
|
72
72
|
* mailerOptions: { host: 'smtp.example.com', port: 587, ... },
|
|
@@ -80,7 +80,7 @@ declare function enqueueEmail(queue: Queue<QueueEmailMessage>, message: QueueEma
|
|
|
80
80
|
*
|
|
81
81
|
* @example
|
|
82
82
|
* ```typescript
|
|
83
|
-
* import { enqueueEmails } from '@
|
|
83
|
+
* import { enqueueEmails } from '@workermailer/smtp/queue'
|
|
84
84
|
*
|
|
85
85
|
* await enqueueEmails(env.EMAIL_QUEUE, [
|
|
86
86
|
* { mailerOptions: {...}, emailOptions: {...} },
|
package/dist/queue.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ type QueueProcessResult = {
|
|
|
26
26
|
* @example
|
|
27
27
|
* ```typescript
|
|
28
28
|
* // In your worker:
|
|
29
|
-
* import { createQueueHandler } from '@
|
|
29
|
+
* import { createQueueHandler } from '@workermailer/smtp/queue'
|
|
30
30
|
*
|
|
31
31
|
* export default {
|
|
32
32
|
* async queue(batch, env, ctx) {
|
|
@@ -66,7 +66,7 @@ declare function createQueueHandler(options?: {
|
|
|
66
66
|
*
|
|
67
67
|
* @example
|
|
68
68
|
* ```typescript
|
|
69
|
-
* import { enqueueEmail } from '@
|
|
69
|
+
* import { enqueueEmail } from '@workermailer/smtp/queue'
|
|
70
70
|
*
|
|
71
71
|
* await enqueueEmail(env.EMAIL_QUEUE, {
|
|
72
72
|
* mailerOptions: { host: 'smtp.example.com', port: 587, ... },
|
|
@@ -80,7 +80,7 @@ declare function enqueueEmail(queue: Queue<QueueEmailMessage>, message: QueueEma
|
|
|
80
80
|
*
|
|
81
81
|
* @example
|
|
82
82
|
* ```typescript
|
|
83
|
-
* import { enqueueEmails } from '@
|
|
83
|
+
* import { enqueueEmails } from '@workermailer/smtp/queue'
|
|
84
84
|
*
|
|
85
85
|
* await enqueueEmails(env.EMAIL_QUEUE, [
|
|
86
86
|
* { mailerOptions: {...}, emailOptions: {...} },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workermailer/smtp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"packageManager": "bun@1.3.11",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"url": "git+https://github.com/RibasSu/worker-mailer.git"
|
|
34
34
|
},
|
|
35
35
|
"license": "MIT",
|
|
36
|
-
"homepage": "https://workermailer.com
|
|
36
|
+
"homepage": "https://workermailer.com",
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public",
|
|
39
39
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@changesets/cli": "^2.30.0",
|
|
48
48
|
"@cloudflare/vitest-pool-workers": "^0.12.21",
|
|
49
|
-
"@cloudflare/workers-types": "^4.
|
|
49
|
+
"@cloudflare/workers-types": "^4.20260409.1",
|
|
50
50
|
"@types/libqp": "^1.1.3",
|
|
51
|
-
"@types/node": "^25.5.
|
|
51
|
+
"@types/node": "^25.5.2",
|
|
52
52
|
"letterparser": "^0.1.8",
|
|
53
53
|
"libqp": "^2.1.1",
|
|
54
54
|
"prettier": "^3.8.1",
|
|
55
55
|
"tsup": "^8.5.1",
|
|
56
56
|
"typescript": "^5.9.3",
|
|
57
57
|
"vitest": "^3.2.4",
|
|
58
|
-
"wrangler": "^4.
|
|
58
|
+
"wrangler": "^4.81.0"
|
|
59
59
|
}
|
|
60
60
|
}
|