@activepieces/piece-smtp 0.1.5 → 0.1.7
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/package.json +3 -3
- package/src/index.d.ts +2 -2
- package/src/index.js +15 -17
- package/src/index.js.map +1 -1
- package/src/lib/actions/send-email.d.ts +1 -1
- package/src/lib/actions/send-email.js +2 -14
- package/src/lib/actions/send-email.js.map +1 -1
- package/src/lib/common/index.d.ts +22 -0
- package/src/lib/common/index.js +26 -0
- package/src/lib/common/index.js.map +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-smtp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@sinclair/typebox": "0.26.8",
|
|
6
6
|
"axios": "^1.6.3",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"nanoid": "3.3.6",
|
|
11
11
|
"nodemailer": "6.9.9",
|
|
12
12
|
"semver": "7.6.0",
|
|
13
|
-
"@activepieces/pieces-framework": "0.7.
|
|
14
|
-
"@activepieces/shared": "0.10.
|
|
13
|
+
"@activepieces/pieces-framework": "0.7.20",
|
|
14
|
+
"@activepieces/shared": "0.10.86",
|
|
15
15
|
"tslib": "2.6.2"
|
|
16
16
|
},
|
|
17
17
|
"main": "./src/index.js",
|
package/src/index.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ export declare const smtpAuth: import("@activepieces/pieces-framework").CustomAu
|
|
|
2
2
|
host: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
3
|
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
4
|
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
-
port: import("@activepieces/pieces-framework").
|
|
5
|
+
port: import("@activepieces/pieces-framework").StaticDropdownProperty<number, true>;
|
|
6
6
|
TLS: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
7
7
|
}>;
|
|
8
8
|
export declare const smtp: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
9
9
|
host: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
10
|
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
11
11
|
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
12
|
-
port: import("@activepieces/pieces-framework").
|
|
12
|
+
port: import("@activepieces/pieces-framework").StaticDropdownProperty<number, true>;
|
|
13
13
|
TLS: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
14
14
|
}>>;
|
package/src/index.js
CHANGED
|
@@ -4,8 +4,9 @@ exports.smtp = exports.smtpAuth = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const shared_1 = require("@activepieces/shared");
|
|
7
|
-
const nodemailer_1 = tslib_1.__importDefault(require("nodemailer"));
|
|
8
7
|
const send_email_1 = require("./lib/actions/send-email");
|
|
8
|
+
const common_1 = require("./lib/common");
|
|
9
|
+
const SMTPPorts = [25, 465, 587, 2525];
|
|
9
10
|
exports.smtpAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
10
11
|
required: true,
|
|
11
12
|
props: {
|
|
@@ -21,31 +22,28 @@ exports.smtpAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
|
21
22
|
displayName: 'Password',
|
|
22
23
|
required: true,
|
|
23
24
|
}),
|
|
24
|
-
port: pieces_framework_1.Property.
|
|
25
|
+
port: pieces_framework_1.Property.StaticDropdown({
|
|
25
26
|
displayName: 'Port',
|
|
26
27
|
required: true,
|
|
28
|
+
options: {
|
|
29
|
+
disabled: false,
|
|
30
|
+
options: SMTPPorts.map((port) => {
|
|
31
|
+
return {
|
|
32
|
+
label: port.toString(),
|
|
33
|
+
value: port,
|
|
34
|
+
};
|
|
35
|
+
}),
|
|
36
|
+
},
|
|
27
37
|
}),
|
|
28
38
|
TLS: pieces_framework_1.Property.Checkbox({
|
|
29
|
-
displayName: '
|
|
39
|
+
displayName: 'Require TLS?',
|
|
30
40
|
defaultValue: false,
|
|
31
41
|
required: true,
|
|
32
42
|
}),
|
|
33
43
|
},
|
|
34
44
|
validate: ({ auth }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
35
45
|
try {
|
|
36
|
-
const transporter =
|
|
37
|
-
host: auth.host,
|
|
38
|
-
port: +auth.port,
|
|
39
|
-
auth: {
|
|
40
|
-
user: auth.email,
|
|
41
|
-
pass: auth.password,
|
|
42
|
-
},
|
|
43
|
-
connectionTimeout: 10000,
|
|
44
|
-
secure: auth.TLS === true ? true : undefined,
|
|
45
|
-
tls: {
|
|
46
|
-
rejectUnauthorized: false,
|
|
47
|
-
}
|
|
48
|
-
});
|
|
46
|
+
const transporter = common_1.smtpCommon.createSMTPTransport(auth);
|
|
49
47
|
return new Promise((resolve, reject) => {
|
|
50
48
|
transporter.verify(function (error, success) {
|
|
51
49
|
if (error) {
|
|
@@ -70,7 +68,7 @@ exports.smtp = (0, pieces_framework_1.createPiece)({
|
|
|
70
68
|
minimumSupportedRelease: '0.5.0',
|
|
71
69
|
logoUrl: 'https://cdn.activepieces.com/pieces/smtp.png',
|
|
72
70
|
categories: [shared_1.PieceCategory.CORE],
|
|
73
|
-
authors: ['abaza738'],
|
|
71
|
+
authors: ['abaza738', 'kishanprmr'],
|
|
74
72
|
auth: exports.smtpAuth,
|
|
75
73
|
actions: [send_email_1.sendEmail],
|
|
76
74
|
triggers: [],
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/smtp/src/index.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/smtp/src/index.ts"],"names":[],"mappings":";;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AW,CAAC,MAAM,CAAC,UAAU,KAAK,EAAE,OAAO;oBACzC,IAAI,KAAK,EAAE;wBACT,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;qBACzD;yBAAM;wBACL,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;qBAC1B;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;QAAC,OAAO,CAAC,EAAE;YACV,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;aACzB,CAAC;SACH;IACH,CAAC,CAAA;CACF,CAAC,CAAC;AAEU,QAAA,IAAI,GAAG,IAAA,8BAAW,EAAC;IAC9B,WAAW,EAAE,MAAM;IACnB,uBAAuB,EAAE,OAAO;IAChC,OAAO,EAAE,8CAA8C;IACvD,UAAU,EAAE,CAAC,sBAAa,CAAC,IAAI,CAAC;IAChC,OAAO,EAAE,CAAC,UAAU,EAAE,YAAY,CAAC;IACnC,IAAI,EAAE,gBAAQ;IACd,OAAO,EAAE,CAAC,sBAAS,CAAC;IACpB,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -2,7 +2,7 @@ export declare const sendEmail: import("@activepieces/pieces-framework").IAction
|
|
|
2
2
|
host: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
3
|
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
4
|
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
-
port: import("@activepieces/pieces-framework").
|
|
5
|
+
port: import("@activepieces/pieces-framework").StaticDropdownProperty<number, true>;
|
|
6
6
|
TLS: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
7
7
|
}>, {
|
|
8
8
|
from: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.sendEmail = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const nodemailer_1 = tslib_1.__importDefault(require("nodemailer"));
|
|
7
6
|
const __1 = require("../..");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
8
|
exports.sendEmail = (0, pieces_framework_1.createAction)({
|
|
9
9
|
auth: __1.smtpAuth,
|
|
10
10
|
name: 'send-email',
|
|
@@ -42,19 +42,7 @@ exports.sendEmail = (0, pieces_framework_1.createAction)({
|
|
|
42
42
|
},
|
|
43
43
|
run: ({ auth, propsValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
44
44
|
var _a, _b;
|
|
45
|
-
const transporter =
|
|
46
|
-
host: auth.host,
|
|
47
|
-
port: +auth.port,
|
|
48
|
-
auth: {
|
|
49
|
-
user: auth.email,
|
|
50
|
-
pass: auth.password,
|
|
51
|
-
},
|
|
52
|
-
connectionTimeout: 10000,
|
|
53
|
-
secure: auth.TLS === true ? true : undefined,
|
|
54
|
-
tls: {
|
|
55
|
-
rejectUnauthorized: false,
|
|
56
|
-
}
|
|
57
|
-
});
|
|
45
|
+
const transporter = common_1.smtpCommon.createSMTPTransport(auth);
|
|
58
46
|
const info = yield transporter.sendMail({
|
|
59
47
|
from: propsValue.from,
|
|
60
48
|
to: propsValue.to.join(','),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-email.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/smtp/src/lib/actions/send-email.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,
|
|
1
|
+
{"version":3,"file":"send-email.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/smtp/src/lib/actions/send-email.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,6BAAiC;AACjC,sCAAuC;AAE1B,QAAA,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I,CAAC,GAAG,CAAC;YAC5B,SAAS,EAAE,UAAU,CAAC,OAAO;YAC7B,GAAG,EAAE,MAAA,UAAU,CAAC,GAAG,0CAAE,IAAI,CAAC,GAAG,CAAC;YAC9B,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,IAAI,EAAE,UAAU,CAAC,IAAI;SACtB,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import nodemailer from 'nodemailer';
|
|
2
|
+
export declare const smtpCommon: {
|
|
3
|
+
constructConfig(auth: smtpAuthParams): {
|
|
4
|
+
host: string;
|
|
5
|
+
port: number;
|
|
6
|
+
requireTLS: boolean;
|
|
7
|
+
auth: {
|
|
8
|
+
user: string;
|
|
9
|
+
pass: string;
|
|
10
|
+
};
|
|
11
|
+
connectionTimeout: number;
|
|
12
|
+
secure: boolean;
|
|
13
|
+
};
|
|
14
|
+
createSMTPTransport(auth: smtpAuthParams): nodemailer.Transporter<import("nodemailer/lib/smtp-transport").SentMessageInfo>;
|
|
15
|
+
};
|
|
16
|
+
export type smtpAuthParams = {
|
|
17
|
+
host: string;
|
|
18
|
+
email: string;
|
|
19
|
+
password: string;
|
|
20
|
+
port: number;
|
|
21
|
+
TLS: boolean;
|
|
22
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.smtpCommon = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const nodemailer_1 = tslib_1.__importDefault(require("nodemailer"));
|
|
6
|
+
exports.smtpCommon = {
|
|
7
|
+
constructConfig(auth) {
|
|
8
|
+
return {
|
|
9
|
+
host: auth.host,
|
|
10
|
+
port: auth.port,
|
|
11
|
+
requireTLS: auth.TLS,
|
|
12
|
+
auth: {
|
|
13
|
+
user: auth.email,
|
|
14
|
+
pass: auth.password,
|
|
15
|
+
},
|
|
16
|
+
connectionTimeout: 10000,
|
|
17
|
+
secure: auth.port === 465,
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
createSMTPTransport(auth) {
|
|
21
|
+
const smtpOptions = exports.smtpCommon.constructConfig(auth);
|
|
22
|
+
const transporter = nodemailer_1.default.createTransport(smtpOptions);
|
|
23
|
+
return transporter;
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/smtp/src/lib/common/index.ts"],"names":[],"mappings":";;;;AAAA,oEAAoC;AAEvB,QAAA,UAAU,GAAG;IACxB,eAAe,CAAC,IAAoB;QAClC,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,UAAU,EAAE,IAAI,CAAC,GAAG;YACpB,IAAI,EAAE;gBACJ,IAAI,EAAE,IAAI,CAAC,KAAK;gBAChB,IAAI,EAAE,IAAI,CAAC,QAAQ;aACpB;YACD,iBAAiB,EAAE,KAAK;YACxB,MAAM,EAAE,IAAI,CAAC,IAAI,KAAK,GAAG;SAC1B,CAAC;IACJ,CAAC;IACD,mBAAmB,CAAC,IAAoB;QACtC,MAAM,WAAW,GAAG,kBAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACrD,MAAM,WAAW,GAAG,oBAAU,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QAC5D,OAAO,WAAW,CAAC;IACrB,CAAC;CACF,CAAC"}
|