@activepieces/piece-smtp 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ # pieces-smtp
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Running lint
6
+
7
+ Run `nx lint pieces-smtp` to execute the lint via [ESLint](https://eslint.org/).
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@activepieces/piece-smtp",
3
+ "version": "0.0.1",
4
+ "devDependencies": {
5
+ "@types/nodemailer": "^6.4.7"
6
+ },
7
+ "dependencies": {
8
+ "@sinclair/typebox": "0.26.3",
9
+ "axios": "1.2.4",
10
+ "nanoid": "3.3.4",
11
+ "nodemailer": "6.9.1",
12
+ "@activepieces/framework": "0.3.9",
13
+ "@activepieces/shared": "0.3.5",
14
+ "tslib": "2.4.1"
15
+ },
16
+ "main": "./src/index.js",
17
+ "types": "./src/index.d.ts"
18
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const smtp: import("@activepieces/framework").Piece;
package/src/index.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.smtp = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const framework_1 = require("@activepieces/framework");
6
+ const package_json_1 = tslib_1.__importDefault(require("../package.json"));
7
+ const send_email_1 = require("./lib/actions/send-email");
8
+ exports.smtp = (0, framework_1.createPiece)({
9
+ name: 'smtp',
10
+ displayName: 'smtp',
11
+ logoUrl: 'https://cdn.activepieces.com/pieces/smtp.png',
12
+ version: package_json_1.default.version,
13
+ authors: [
14
+ 'abaza738'
15
+ ],
16
+ actions: [
17
+ send_email_1.sendEmail,
18
+ ],
19
+ triggers: [],
20
+ });
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/smtp/src/index.ts"],"names":[],"mappings":";;;;AACA,uDAAsD;AACtD,2EAA0C;AAC1C,yDAAqD;AAExC,QAAA,IAAI,GAAG,IAAA,uBAAW,EAAC;IAC9B,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,MAAM;IACnB,OAAO,EAAE,8CAA8C;IACvD,OAAO,EAAE,sBAAW,CAAC,OAAO;IAC5B,OAAO,EAAE;QACP,UAAU;KACX;IACD,OAAO,EAAE;QACP,sBAAS;KACV;IACD,QAAQ,EAAE,EACT;CACF,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const sendEmail: import("@activepieces/framework").Action;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendEmail = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const framework_1 = require("@activepieces/framework");
6
+ const framework_2 = require("@activepieces/framework");
7
+ const nodemailer_1 = tslib_1.__importDefault(require("nodemailer"));
8
+ exports.sendEmail = (0, framework_1.createAction)({
9
+ name: 'send-email',
10
+ displayName: 'Send Email',
11
+ description: 'Send an email using a custom SMTP server.',
12
+ props: {
13
+ authentication: framework_2.Property.CustomAuth({
14
+ displayName: 'Authentication',
15
+ required: true,
16
+ props: {
17
+ host: framework_2.Property.ShortText({
18
+ displayName: 'Host',
19
+ required: true,
20
+ }),
21
+ email: framework_2.Property.ShortText({
22
+ displayName: 'Email',
23
+ required: true,
24
+ }),
25
+ password: framework_2.Property.SecretText({
26
+ displayName: 'Password',
27
+ required: true,
28
+ }),
29
+ port: framework_2.Property.Number({
30
+ displayName: 'Port',
31
+ required: true,
32
+ }),
33
+ TLS: framework_2.Property.Checkbox({
34
+ displayName: 'Use TLS',
35
+ required: true,
36
+ }),
37
+ },
38
+ }),
39
+ from: framework_2.Property.ShortText({
40
+ displayName: 'From',
41
+ required: true,
42
+ }),
43
+ to: framework_2.Property.Array({
44
+ displayName: 'To',
45
+ required: true,
46
+ }),
47
+ cc: framework_2.Property.Array({
48
+ displayName: 'CC',
49
+ required: false,
50
+ }),
51
+ replyTo: framework_2.Property.ShortText({
52
+ displayName: 'Reply To',
53
+ required: false,
54
+ }),
55
+ bcc: framework_2.Property.Array({
56
+ displayName: 'BCC',
57
+ required: false,
58
+ }),
59
+ subject: framework_2.Property.ShortText({
60
+ displayName: 'Subject',
61
+ required: true,
62
+ }),
63
+ body: framework_2.Property.LongText({
64
+ displayName: 'Body',
65
+ required: true,
66
+ }),
67
+ },
68
+ run: ({ propsValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
69
+ var _a, _b;
70
+ const transporter = nodemailer_1.default.createTransport({
71
+ host: propsValue.authentication.host,
72
+ port: +propsValue.authentication.port,
73
+ auth: {
74
+ user: propsValue.authentication.email,
75
+ pass: propsValue.authentication.password,
76
+ },
77
+ secure: propsValue.authentication.TLS,
78
+ });
79
+ const info = yield transporter.sendMail({
80
+ from: propsValue.from,
81
+ to: propsValue.to.join(','),
82
+ cc: (_a = propsValue.cc) === null || _a === void 0 ? void 0 : _a.join(','),
83
+ inReplyTo: propsValue.replyTo,
84
+ bcc: (_b = propsValue.bcc) === null || _b === void 0 ? void 0 : _b.join(','),
85
+ subject: propsValue.subject,
86
+ text: propsValue.body,
87
+ });
88
+ return info;
89
+ }),
90
+ });
91
+ //# sourceMappingURL=send-email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-email.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/smtp/src/lib/actions/send-email.ts"],"names":[],"mappings":";;;;AAAA,uDAAuD;AACvD,uDAAmD;AACnD,oEAAoC;AAEvB,QAAA,SAAS,GAAG,IAAA,wBAAY,EAAC;IAClC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,2CAA2C;IACxD,KAAK,EAAE;QACH,cAAc,EAAE,oBAAQ,CAAC,UAAU,CAAC;YAChC,WAAW,EAAE,gBAAgB;YAC7B,QAAQ,EAAE,IAAI;YACd,KAAK,E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