@payloadcms/email-nodemailer 3.0.0-beta.17 → 3.0.0-beta.19
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 +72 -1
- package/package.json +18 -18
package/README.md
CHANGED
|
@@ -1 +1,72 @@
|
|
|
1
|
-
# Nodemailer Email Adapter
|
|
1
|
+
# Nodemailer Email Adapter for Payload
|
|
2
|
+
|
|
3
|
+
This adapter allows you to send emails using the [Nodemailer](https://nodemailer.com/) library.
|
|
4
|
+
|
|
5
|
+
It abstracts all of the email functionality that was in Payload by default in 2.x into a separate package.
|
|
6
|
+
|
|
7
|
+
**NOTE:** Configuring email in Payload 3.0 is now completely optional. However, you will receive a startup warning that email is not configured and also a message if you attempt to send an email.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pnpm add @payloadcms/email-nodemailer` nodemailer
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Using nodemailer.createTransport
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { nodemailerAdapter } from '@payloadcms/email-nodemailer'
|
|
21
|
+
import nodemailer from 'nodemailer'
|
|
22
|
+
|
|
23
|
+
export default buildConfig({
|
|
24
|
+
email: nodemailerAdapter({
|
|
25
|
+
defaultFromAddress: 'info@payloadcms.com',
|
|
26
|
+
defaultFromName: 'Payload',
|
|
27
|
+
// Any Nodemailer transport
|
|
28
|
+
transport: await nodemailer.createTransport({
|
|
29
|
+
host: process.env.SMTP_HOST,
|
|
30
|
+
port: 587,
|
|
31
|
+
auth: {
|
|
32
|
+
user: process.env.SMTP_USER,
|
|
33
|
+
pass: process.env.SMTP_PASS,
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
}),
|
|
37
|
+
})
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Using transportOptions
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { nodemailerAdapter } from '@payloadcms/email-nodemailer'
|
|
44
|
+
|
|
45
|
+
export default buildConfig({
|
|
46
|
+
email: nodemailerAdapter({
|
|
47
|
+
defaultFromAddress: 'info@payloadcms.com',
|
|
48
|
+
defaultFromName: 'Payload',
|
|
49
|
+
// Nodemailer transportOptions
|
|
50
|
+
transportOptions: {
|
|
51
|
+
host: process.env.SMTP_HOST,
|
|
52
|
+
port: 587,
|
|
53
|
+
auth: {
|
|
54
|
+
user: process.env.SMTP_USER,
|
|
55
|
+
pass: process.env.SMTP_PASS,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
})
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
During development, if you pass nothing to `nodemailerAdapter`, it will use the [ethereal.email](https://ethereal.email) service.
|
|
63
|
+
|
|
64
|
+
This will log the ethereal.email details to console on startup.
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { nodemailerAdapter } from '@payloadcms/email-nodemailer'
|
|
68
|
+
|
|
69
|
+
export default buildConfig({
|
|
70
|
+
email: nodemailerAdapter(), // This will be the old ethereal.email functionality
|
|
71
|
+
})
|
|
72
|
+
```
|
package/package.json
CHANGED
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/email-nodemailer",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.19",
|
|
4
4
|
"description": "Payload Nodemailer Email Adapter",
|
|
5
|
+
"homepage": "https://payloadcms.com",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
7
8
|
"url": "https://github.com/payloadcms/payload.git",
|
|
8
9
|
"directory": "packages/email-nodemailer"
|
|
9
10
|
},
|
|
10
11
|
"license": "MIT",
|
|
11
|
-
"homepage": "https://payloadcms.com",
|
|
12
12
|
"author": "Payload CMS, Inc.",
|
|
13
|
-
"main": "./dist/index.js",
|
|
14
|
-
"types": "./dist/index.d.ts",
|
|
15
13
|
"type": "module",
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"nodemailer": "6.9.10"
|
|
18
|
-
},
|
|
19
|
-
"peerDependencies": {
|
|
20
|
-
"payload": "3.0.0-beta.17"
|
|
21
|
-
},
|
|
22
14
|
"exports": {
|
|
23
15
|
".": {
|
|
24
16
|
"import": "./dist/index.js",
|
|
@@ -26,24 +18,32 @@
|
|
|
26
18
|
"types": "./dist/index.d.ts"
|
|
27
19
|
}
|
|
28
20
|
},
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
"engines": {
|
|
33
|
-
"node": ">=18.20.2"
|
|
34
|
-
},
|
|
21
|
+
"main": "./dist/index.js",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
35
23
|
"files": [
|
|
36
24
|
"dist"
|
|
37
25
|
],
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"nodemailer": "6.9.10"
|
|
28
|
+
},
|
|
38
29
|
"devDependencies": {
|
|
39
30
|
"@types/nodemailer": "6.4.14",
|
|
40
|
-
"payload": "3.0.0-beta.
|
|
31
|
+
"payload": "3.0.0-beta.19"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"payload": "3.0.0-beta.19"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=18.20.2"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"registry": "https://registry.npmjs.org/"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "pnpm build:swc && pnpm build:types",
|
|
44
|
+
"build:clean": "find . \\( -type d \\( -name build -o -name dist -o -name .cache \\) -o -type f -name tsconfig.tsbuildinfo \\) -exec rm -rf {} + && pnpm build",
|
|
44
45
|
"build:swc": "swc ./src -d ./dist --config-file .swcrc",
|
|
45
46
|
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
46
|
-
"build:clean": "find . \\( -type d \\( -name build -o -name dist -o -name .cache \\) -o -type f -name tsconfig.tsbuildinfo \\) -exec rm -rf {} + && pnpm build",
|
|
47
47
|
"clean": "rimraf {dist,*.tsbuildinfo}"
|
|
48
48
|
}
|
|
49
49
|
}
|