@strapi/provider-email-sendmail 0.0.0-next.c58b405b44c71a93df733024d1f15c069cb6bdca → 0.0.0-next.de5394e73076ccf7aca1e28dc68894e3c43f8b91
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 +23 -0
- package/dist/index.js +41 -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 -40
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Options } from 'sendmail';
|
|
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 = Options;
|
|
18
|
+
declare const _default: {
|
|
19
|
+
init(providerOptions: ProviderOptions, settings: Settings): {
|
|
20
|
+
send(options: SendOptions): Promise<void>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export = _default;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const sendmail_1 = __importDefault(require("sendmail"));
|
|
6
|
+
const utils_1 = __importDefault(require("@strapi/utils"));
|
|
7
|
+
module.exports = {
|
|
8
|
+
init(providerOptions, settings) {
|
|
9
|
+
const sendmail = (0, sendmail_1.default)({
|
|
10
|
+
silent: true,
|
|
11
|
+
...providerOptions,
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
send(options) {
|
|
15
|
+
return new Promise((resolve, reject) => {
|
|
16
|
+
const { from, to, cc, bcc, replyTo, subject, text, html, ...rest } = options;
|
|
17
|
+
const msg = {
|
|
18
|
+
from: from || settings.defaultFrom,
|
|
19
|
+
to,
|
|
20
|
+
cc,
|
|
21
|
+
bcc,
|
|
22
|
+
replyTo: replyTo || settings.defaultReplyTo,
|
|
23
|
+
subject,
|
|
24
|
+
text,
|
|
25
|
+
html,
|
|
26
|
+
...rest,
|
|
27
|
+
};
|
|
28
|
+
sendmail(utils_1.default.removeUndefined(msg), (err) => {
|
|
29
|
+
if (err) {
|
|
30
|
+
reject(err);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
resolve();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,wDAA+D;AAC/D,0DAAkC;AAqBlC,iBAAS;IACP,IAAI,CAAC,eAAgC,EAAE,QAAkB;QACvD,MAAM,QAAQ,GAAG,IAAA,kBAAe,EAAC;YAC/B,MAAM,EAAE,IAAI;YACZ,GAAG,eAAe;SACnB,CAAC,CAAC;QAEH,OAAO;YACL,IAAI,CAAC,OAAoB;gBACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;oBACrC,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;oBAE7E,MAAM,GAAG,GAAc;wBACrB,IAAI,EAAE,IAAI,IAAI,QAAQ,CAAC,WAAW;wBAClC,EAAE;wBACF,EAAE;wBACF,GAAG;wBACH,OAAO,EAAE,OAAO,IAAI,QAAQ,CAAC,cAAc;wBAC3C,OAAO;wBACP,IAAI;wBACJ,IAAI;wBACJ,GAAG,IAAI;qBACR,CAAC;oBAEF,QAAQ,CAAC,eAAK,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE;wBAC3C,IAAI,GAAG,EAAE;4BACP,MAAM,CAAC,GAAG,CAAC,CAAC;yBACb;6BAAM;4BACL,OAAO,EAAE,CAAC;yBACX;oBACH,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/provider-email-sendmail",
|
|
3
|
-
"version": "0.0.0-next.
|
|
3
|
+
"version": "0.0.0-next.de5394e73076ccf7aca1e28dc68894e3c43f8b91",
|
|
4
4
|
"description": "Sendmail provider for strapi email",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"email",
|
|
@@ -27,20 +27,31 @@
|
|
|
27
27
|
"url": "https://strapi.io"
|
|
28
28
|
}
|
|
29
29
|
],
|
|
30
|
-
"main": "./
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
"main": "./dist/index.js",
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"files": [
|
|
33
|
+
"./dist"
|
|
34
|
+
],
|
|
34
35
|
"scripts": {
|
|
36
|
+
"build": "run -T tsc",
|
|
37
|
+
"build:ts": "run -T tsc",
|
|
38
|
+
"watch": "run -T tsc -w --preserveWatchOutput",
|
|
39
|
+
"clean": "run -T rimraf ./dist",
|
|
40
|
+
"prepublishOnly": "yarn clean && yarn build",
|
|
35
41
|
"lint": "run -T eslint ."
|
|
36
42
|
},
|
|
37
43
|
"dependencies": {
|
|
38
|
-
"@strapi/utils": "0.0.0-next.
|
|
44
|
+
"@strapi/utils": "0.0.0-next.de5394e73076ccf7aca1e28dc68894e3c43f8b91",
|
|
39
45
|
"sendmail": "^1.6.1"
|
|
40
46
|
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/sendmail": "1.4.4",
|
|
49
|
+
"eslint-config-custom": "0.0.0-next.de5394e73076ccf7aca1e28dc68894e3c43f8b91",
|
|
50
|
+
"tsconfig": "0.0.0-next.de5394e73076ccf7aca1e28dc68894e3c43f8b91"
|
|
51
|
+
},
|
|
41
52
|
"engines": {
|
|
42
53
|
"node": ">=14.19.1 <=18.x.x",
|
|
43
54
|
"npm": ">=6.0.0"
|
|
44
55
|
},
|
|
45
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "de5394e73076ccf7aca1e28dc68894e3c43f8b91"
|
|
46
57
|
}
|
package/.eslintignore
DELETED
package/.eslintrc.js
DELETED
package/lib/index.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const sendmailFactory = require('sendmail');
|
|
4
|
-
const { removeUndefined } = require('@strapi/utils');
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
init(providerOptions = {}, settings = {}) {
|
|
8
|
-
const sendmail = sendmailFactory({
|
|
9
|
-
silent: true,
|
|
10
|
-
...providerOptions,
|
|
11
|
-
});
|
|
12
|
-
return {
|
|
13
|
-
send(options) {
|
|
14
|
-
return new Promise((resolve, reject) => {
|
|
15
|
-
const { from, to, cc, bcc, replyTo, subject, text, html, ...rest } = options;
|
|
16
|
-
|
|
17
|
-
const msg = {
|
|
18
|
-
from: from || settings.defaultFrom,
|
|
19
|
-
to,
|
|
20
|
-
cc,
|
|
21
|
-
bcc,
|
|
22
|
-
replyTo: replyTo || settings.defaultReplyTo,
|
|
23
|
-
subject,
|
|
24
|
-
text,
|
|
25
|
-
html,
|
|
26
|
-
...rest,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
sendmail(removeUndefined(msg), (err) => {
|
|
30
|
-
if (err) {
|
|
31
|
-
reject(err);
|
|
32
|
-
} else {
|
|
33
|
-
resolve();
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
};
|