@strapi/provider-email-nodemailer 0.0.0-next.7408df892b5a12da19143747d41f1e9614a29688 → 0.0.0-next.83d394f47f5b5ee11b31f535997dd73358434317
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/dist/index.d.ts +25 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/package.json +18 -7
- package/.eslintignore +0 -2
- package/.eslintrc.js +0 -4
- package/lib/index.js +0 -44
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import nodemailer from 'nodemailer';
|
|
2
|
+
interface Settings {
|
|
3
|
+
defaultFrom: string;
|
|
4
|
+
defaultReplyTo: string;
|
|
5
|
+
}
|
|
6
|
+
interface SendOptions {
|
|
7
|
+
from?: string;
|
|
8
|
+
to: string;
|
|
9
|
+
cc: string;
|
|
10
|
+
bcc: string;
|
|
11
|
+
replyTo?: string;
|
|
12
|
+
subject: string;
|
|
13
|
+
text: string;
|
|
14
|
+
html: string;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
type ProviderOptions = Parameters<typeof nodemailer.createTransport>[0];
|
|
18
|
+
declare const _default: {
|
|
19
|
+
provider: string;
|
|
20
|
+
name: string;
|
|
21
|
+
init(providerOptions: ProviderOptions, settings: Settings): {
|
|
22
|
+
send(options: SendOptions): Promise<unknown>;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export = _default;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
6
|
+
const nodemailer_1 = __importDefault(require("nodemailer"));
|
|
7
|
+
const emailFields = [
|
|
8
|
+
'from',
|
|
9
|
+
'replyTo',
|
|
10
|
+
'to',
|
|
11
|
+
'cc',
|
|
12
|
+
'bcc',
|
|
13
|
+
'subject',
|
|
14
|
+
'text',
|
|
15
|
+
'html',
|
|
16
|
+
'attachments',
|
|
17
|
+
];
|
|
18
|
+
module.exports = {
|
|
19
|
+
provider: 'nodemailer',
|
|
20
|
+
name: 'Nodemailer',
|
|
21
|
+
init(providerOptions, settings) {
|
|
22
|
+
const transporter = nodemailer_1.default.createTransport(providerOptions);
|
|
23
|
+
return {
|
|
24
|
+
send(options) {
|
|
25
|
+
// Default values.
|
|
26
|
+
const emailOptions = {
|
|
27
|
+
...lodash_1.default.pick(options, emailFields),
|
|
28
|
+
from: options.from || settings.defaultFrom,
|
|
29
|
+
replyTo: options.replyTo || settings.defaultReplyTo,
|
|
30
|
+
text: options.text || options.html,
|
|
31
|
+
html: options.html || options.text,
|
|
32
|
+
};
|
|
33
|
+
return transporter.sendMail(emailOptions);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,oDAAuB;AACvB,4DAAyD;AAqBzD,MAAM,WAAW,GAAG;IAClB,MAAM;IACN,SAAS;IACT,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,SAAS;IACT,MAAM;IACN,MAAM;IACN,aAAa;CACd,CAAC;AAEF,iBAAS;IACP,QAAQ,EAAE,YAAY;IACtB,IAAI,EAAE,YAAY;IAElB,IAAI,CAAC,eAAgC,EAAE,QAAkB;QACvD,MAAM,WAAW,GAAG,oBAAU,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;QAEhE,OAAO;YACL,IAAI,CAAC,OAAoB;gBACvB,kBAAkB;gBAClB,MAAM,YAAY,GAAoB;oBACpC,GAAG,gBAAC,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC;oBAC/B,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,QAAQ,CAAC,WAAW;oBAC1C,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,QAAQ,CAAC,cAAc;oBACnD,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI;oBAClC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI;iBACnC,CAAC;gBAEF,OAAO,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YAC5C,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/provider-email-nodemailer",
|
|
3
|
-
"version": "0.0.0-next.
|
|
3
|
+
"version": "0.0.0-next.83d394f47f5b5ee11b31f535997dd73358434317",
|
|
4
4
|
"description": "Nodemailer provider for Strapi 3",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -41,20 +41,31 @@
|
|
|
41
41
|
"email": "git@roschaefer.de"
|
|
42
42
|
}
|
|
43
43
|
],
|
|
44
|
-
"main": "./
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
"main": "./dist/index.js",
|
|
45
|
+
"types": "./dist/index.d.ts",
|
|
46
|
+
"files": [
|
|
47
|
+
"./dist"
|
|
48
|
+
],
|
|
48
49
|
"scripts": {
|
|
49
|
-
"
|
|
50
|
+
"build": "run -T tsc",
|
|
51
|
+
"build:ts": "run -T tsc",
|
|
52
|
+
"watch": "run -T tsc -w --preserveWatchOutput",
|
|
53
|
+
"clean": "run -T rimraf ./dist",
|
|
54
|
+
"prepublishOnly": "yarn clean && yarn build",
|
|
55
|
+
"lint": "run -T eslint ."
|
|
50
56
|
},
|
|
51
57
|
"dependencies": {
|
|
52
58
|
"lodash": "4.17.21",
|
|
53
59
|
"nodemailer": "6.9.1"
|
|
54
60
|
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/nodemailer": "6.4.7",
|
|
63
|
+
"eslint-config-custom": "0.0.0-next.83d394f47f5b5ee11b31f535997dd73358434317",
|
|
64
|
+
"tsconfig": "0.0.0-next.83d394f47f5b5ee11b31f535997dd73358434317"
|
|
65
|
+
},
|
|
55
66
|
"engines": {
|
|
56
67
|
"node": ">=14.19.1 <=18.x.x",
|
|
57
68
|
"npm": ">=6.0.0"
|
|
58
69
|
},
|
|
59
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "83d394f47f5b5ee11b31f535997dd73358434317"
|
|
60
71
|
}
|
package/.eslintignore
DELETED
package/.eslintrc.js
DELETED
package/lib/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Module dependencies
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const _ = require('lodash');
|
|
8
|
-
const nodemailer = require('nodemailer');
|
|
9
|
-
|
|
10
|
-
const emailFields = [
|
|
11
|
-
'from',
|
|
12
|
-
'replyTo',
|
|
13
|
-
'to',
|
|
14
|
-
'cc',
|
|
15
|
-
'bcc',
|
|
16
|
-
'subject',
|
|
17
|
-
'text',
|
|
18
|
-
'html',
|
|
19
|
-
'attachments',
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
module.exports = {
|
|
23
|
-
provider: 'nodemailer',
|
|
24
|
-
name: 'Nodemailer',
|
|
25
|
-
|
|
26
|
-
init(providerOptions = {}, settings = {}) {
|
|
27
|
-
const transporter = nodemailer.createTransport(providerOptions);
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
send(options) {
|
|
31
|
-
// Default values.
|
|
32
|
-
const emailOptions = {
|
|
33
|
-
..._.pick(options, emailFields),
|
|
34
|
-
from: options.from || settings.defaultFrom,
|
|
35
|
-
replyTo: options.replyTo || settings.defaultReplyTo,
|
|
36
|
-
text: options.text || options.html,
|
|
37
|
-
html: options.html || options.text,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
return transporter.sendMail(emailOptions);
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
},
|
|
44
|
-
};
|