n8n-nodes-hostinger-mail 0.1.0

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.
Files changed (33) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +70 -0
  3. package/dist/credentials/HostingerMailApi.credentials.d.ts +10 -0
  4. package/dist/credentials/HostingerMailApi.credentials.js +39 -0
  5. package/dist/credentials/HostingerMailApi.credentials.js.map +1 -0
  6. package/dist/nodes/HostingerMail/GenericFunctions.d.ts +6 -0
  7. package/dist/nodes/HostingerMail/GenericFunctions.js +56 -0
  8. package/dist/nodes/HostingerMail/GenericFunctions.js.map +1 -0
  9. package/dist/nodes/HostingerMail/HostingerMail.node.d.ts +11 -0
  10. package/dist/nodes/HostingerMail/HostingerMail.node.js +445 -0
  11. package/dist/nodes/HostingerMail/HostingerMail.node.js.map +1 -0
  12. package/dist/nodes/HostingerMail/HostingerMail.node.json +18 -0
  13. package/dist/nodes/HostingerMail/descriptions/EmailDescription.d.ts +3 -0
  14. package/dist/nodes/HostingerMail/descriptions/EmailDescription.js +182 -0
  15. package/dist/nodes/HostingerMail/descriptions/EmailDescription.js.map +1 -0
  16. package/dist/nodes/HostingerMail/descriptions/FolderDescription.d.ts +3 -0
  17. package/dist/nodes/HostingerMail/descriptions/FolderDescription.js +92 -0
  18. package/dist/nodes/HostingerMail/descriptions/FolderDescription.js.map +1 -0
  19. package/dist/nodes/HostingerMail/descriptions/MessageDescription.d.ts +3 -0
  20. package/dist/nodes/HostingerMail/descriptions/MessageDescription.js +399 -0
  21. package/dist/nodes/HostingerMail/descriptions/MessageDescription.js.map +1 -0
  22. package/dist/nodes/HostingerMail/descriptions/WebhookDescription.d.ts +3 -0
  23. package/dist/nodes/HostingerMail/descriptions/WebhookDescription.js +238 -0
  24. package/dist/nodes/HostingerMail/descriptions/WebhookDescription.js.map +1 -0
  25. package/dist/nodes/HostingerMail/hostingerMail.svg +5 -0
  26. package/dist/nodes/HostingerMailTrigger/HostingerMailTrigger.node.d.ts +17 -0
  27. package/dist/nodes/HostingerMailTrigger/HostingerMailTrigger.node.js +135 -0
  28. package/dist/nodes/HostingerMailTrigger/HostingerMailTrigger.node.js.map +1 -0
  29. package/dist/nodes/HostingerMailTrigger/HostingerMailTrigger.node.json +18 -0
  30. package/dist/nodes/HostingerMailTrigger/hostingerMail.svg +5 -0
  31. package/dist/package.json +54 -0
  32. package/dist/tsconfig.tsbuildinfo +1 -0
  33. package/package.json +54 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Povilas Skrebutenas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # n8n-nodes-hostinger-mail
2
+
3
+ This is an [n8n](https://n8n.io/) community node package for the [Hostinger Email API](https://api.mail.hostinger.com/). It lets you send and manage email in your Hostinger mailboxes from n8n workflows, and trigger workflows when new mail arrives.
4
+
5
+ The package contains two nodes:
6
+
7
+ - **Hostinger Mail** — call the Hostinger Email API (send email, manage messages, folders and webhooks)
8
+ - **Hostinger Mail Trigger** — start a workflow when a new email arrives in a mailbox (uses the API's `message.received` webhook)
9
+
10
+ ## Installation
11
+
12
+ Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
13
+
14
+ In a self-hosted n8n instance: **Settings → Community Nodes → Install**, then enter `n8n-nodes-hostinger-mail`.
15
+
16
+ ## Credentials
17
+
18
+ 1. Generate an API token for Hostinger Email (in hPanel, under your email plan).
19
+ 2. In n8n, create new **Hostinger Mail API** credentials and paste the token.
20
+ 3. The credential test calls `GET /api/v1/me` to verify the token.
21
+
22
+ The token is sent as a `Authorization: Bearer <token>` header on every request.
23
+
24
+ ## Hostinger Mail node
25
+
26
+ | Resource | Operations |
27
+ |----------|------------|
28
+ | Account | Get (authenticated account and manageable mailboxes) |
29
+ | Email | Send (text/HTML body, CC/BCC, attachments from binary data, inline images via Content-ID) |
30
+ | Message | Get, Get Many, Search, Get Text, Get Source (.eml as binary), Download Attachment (binary), Move, Move Many, Update Flags, Update Flags Many, Delete, Delete Many, Delete All |
31
+ | Folder | Get Many, Create, Update (rename), Delete |
32
+ | Webhook | Get, Get Many, Create, Update, Delete, Regenerate Secret, Test |
33
+
34
+ Mailboxes and folders are loaded dynamically into dropdowns from your account, and can also be set with expressions.
35
+
36
+ ## Hostinger Mail Trigger node
37
+
38
+ Select a mailbox and activate the workflow. The node automatically:
39
+
40
+ 1. Registers a webhook for the `message.received` event pointing at your n8n webhook URL.
41
+ 2. Verifies each delivery using the webhook secret (sent by Hostinger as a bearer token).
42
+ 3. Removes the webhook when the workflow is deactivated.
43
+
44
+ Your n8n instance must be reachable from the internet for deliveries to arrive (set `WEBHOOK_URL` if you are behind a proxy).
45
+
46
+ ## Development
47
+
48
+ ```bash
49
+ npm install
50
+ npm run dev # run n8n locally with the node loaded
51
+ npm run lint # lint with the n8n community node rules
52
+ npm run build # build to dist/
53
+ ```
54
+
55
+ ## Publishing
56
+
57
+ ```bash
58
+ npm run release
59
+ ```
60
+
61
+ This bumps the version, tags, and pushes; the included GitHub Actions workflow (`.github/workflows/publish.yml`) publishes to npm. Alternatively run `npm publish` directly after `npm run build`.
62
+
63
+ ## Resources
64
+
65
+ - [Hostinger Email API reference](https://api.mail.hostinger.com/)
66
+ - [n8n community nodes documentation](https://docs.n8n.io/integrations/community-nodes/)
67
+
68
+ ## License
69
+
70
+ [MIT](LICENSE)
@@ -0,0 +1,10 @@
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, Icon, INodeProperties } from 'n8n-workflow';
2
+ export declare class HostingerMailApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ icon: Icon;
6
+ documentationUrl: string;
7
+ properties: INodeProperties[];
8
+ authenticate: IAuthenticateGeneric;
9
+ test: ICredentialTestRequest;
10
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HostingerMailApi = void 0;
4
+ class HostingerMailApi {
5
+ constructor() {
6
+ this.name = 'hostingerMailApi';
7
+ this.displayName = 'Hostinger Mail API';
8
+ this.icon = 'file:../nodes/HostingerMail/hostingerMail.svg';
9
+ this.documentationUrl = 'https://api.mail.hostinger.com/';
10
+ this.properties = [
11
+ {
12
+ displayName: 'API Token',
13
+ name: 'apiToken',
14
+ type: 'string',
15
+ typeOptions: { password: true },
16
+ required: true,
17
+ default: '',
18
+ description: 'API token for the Hostinger Email API. Generate one in hPanel under Emails → Automation.',
19
+ },
20
+ ];
21
+ this.authenticate = {
22
+ type: 'generic',
23
+ properties: {
24
+ headers: {
25
+ Authorization: '=Bearer {{$credentials.apiToken}}',
26
+ },
27
+ },
28
+ };
29
+ this.test = {
30
+ request: {
31
+ baseURL: 'https://api.mail.hostinger.com',
32
+ url: '/api/v1/me',
33
+ method: 'GET',
34
+ },
35
+ };
36
+ }
37
+ }
38
+ exports.HostingerMailApi = HostingerMailApi;
39
+ //# sourceMappingURL=HostingerMailApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HostingerMailApi.credentials.js","sourceRoot":"","sources":["../../credentials/HostingerMailApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,gBAAgB;IAA7B;QACC,SAAI,GAAG,kBAAkB,CAAC;QAE1B,gBAAW,GAAG,oBAAoB,CAAC;QAEnC,SAAI,GAAS,+CAA+C,CAAC;QAE7D,qBAAgB,GAAG,iCAAiC,CAAC;QAErD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EACV,0FAA0F;aAC3F;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,mCAAmC;iBAClD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,gCAAgC;gBACzC,GAAG,EAAE,YAAY;gBACjB,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AAtCD,4CAsCC"}
@@ -0,0 +1,6 @@
1
+ import type { IDataObject, IExecuteFunctions, IHookFunctions, IHttpRequestMethods, IHttpRequestOptions, ILoadOptionsFunctions, IWebhookFunctions } from 'n8n-workflow';
2
+ export declare const BASE_URL = "https://api.mail.hostinger.com/api/v1";
3
+ export declare function hostingerMailApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions | IWebhookFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject, qs?: IDataObject, options?: Partial<IHttpRequestOptions>): Promise<any>;
4
+ export declare function hostingerMailApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject, qs?: IDataObject, limit?: number): Promise<IDataObject[]>;
5
+ export declare function parseStringList(value: string): string[];
6
+ export declare function encodeFolderPath(folder: string): string;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BASE_URL = void 0;
4
+ exports.hostingerMailApiRequest = hostingerMailApiRequest;
5
+ exports.hostingerMailApiRequestAllItems = hostingerMailApiRequestAllItems;
6
+ exports.parseStringList = parseStringList;
7
+ exports.encodeFolderPath = encodeFolderPath;
8
+ exports.BASE_URL = 'https://api.mail.hostinger.com/api/v1';
9
+ async function hostingerMailApiRequest(method, endpoint, body = {}, qs = {}, options = {}) {
10
+ const requestOptions = {
11
+ method,
12
+ url: `${exports.BASE_URL}${endpoint}`,
13
+ qs,
14
+ body,
15
+ json: true,
16
+ ...options,
17
+ };
18
+ if (requestOptions.body !== undefined &&
19
+ typeof requestOptions.body === 'object' &&
20
+ requestOptions.body !== null &&
21
+ Object.keys(requestOptions.body).length === 0) {
22
+ delete requestOptions.body;
23
+ }
24
+ return await this.helpers.httpRequestWithAuthentication.call(this, 'hostingerMailApi', requestOptions);
25
+ }
26
+ async function hostingerMailApiRequestAllItems(method, endpoint, body = {}, qs = {}, limit) {
27
+ var _a;
28
+ const returnData = [];
29
+ let page = 1;
30
+ const perPage = limit !== undefined && limit < 100 ? limit : 100;
31
+ let responseData;
32
+ do {
33
+ responseData = (await hostingerMailApiRequest.call(this, method, endpoint, body, {
34
+ ...qs,
35
+ page,
36
+ perPage,
37
+ }));
38
+ returnData.push(...((_a = responseData.data) !== null && _a !== void 0 ? _a : []));
39
+ if (limit !== undefined && returnData.length >= limit) {
40
+ return returnData.slice(0, limit);
41
+ }
42
+ page++;
43
+ } while (responseData.pagination !== undefined &&
44
+ page <= responseData.pagination.totalPages);
45
+ return returnData;
46
+ }
47
+ function parseStringList(value) {
48
+ return value
49
+ .split(',')
50
+ .map((entry) => entry.trim())
51
+ .filter((entry) => entry !== '');
52
+ }
53
+ function encodeFolderPath(folder) {
54
+ return encodeURIComponent(folder);
55
+ }
56
+ //# sourceMappingURL=GenericFunctions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/HostingerMail/GenericFunctions.ts"],"names":[],"mappings":";;;AAYA,0DAgCC;AAED,0EAiCC;AAED,0CAKC;AAED,4CAEC;AAhFY,QAAA,QAAQ,GAAG,uCAAuC,CAAC;AAEzD,KAAK,UAAU,uBAAuB,CAE5C,MAA2B,EAC3B,QAAgB,EAChB,OAAoB,EAAE,EACtB,KAAkB,EAAE,EACpB,UAAwC,EAAE;IAG1C,MAAM,cAAc,GAAwB;QAC3C,MAAM;QACN,GAAG,EAAE,GAAG,gBAAQ,GAAG,QAAQ,EAAE;QAC7B,EAAE;QACF,IAAI;QACJ,IAAI,EAAE,IAAI;QACV,GAAG,OAAO;KACV,CAAC;IAEF,IACC,cAAc,CAAC,IAAI,KAAK,SAAS;QACjC,OAAO,cAAc,CAAC,IAAI,KAAK,QAAQ;QACvC,cAAc,CAAC,IAAI,KAAK,IAAI;QAC5B,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,IAAmB,CAAC,CAAC,MAAM,KAAK,CAAC,EAC3D,CAAC;QACF,OAAO,cAAc,CAAC,IAAI,CAAC;IAC5B,CAAC;IAED,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAC3D,IAAI,EACJ,kBAAkB,EAClB,cAAc,CACd,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,+BAA+B,CAEpD,MAA2B,EAC3B,QAAgB,EAChB,OAAoB,EAAE,EACtB,KAAkB,EAAE,EACpB,KAAc;;IAEd,MAAM,UAAU,GAAkB,EAAE,CAAC;IACrC,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,MAAM,OAAO,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;IAEjE,IAAI,YAAyB,CAAC;IAC9B,GAAG,CAAC;QACH,YAAY,GAAG,CAAC,MAAM,uBAAuB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;YAChF,GAAG,EAAE;YACL,IAAI;YACJ,OAAO;SACP,CAAC,CAAgB,CAAC;QAEnB,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,MAAC,YAAY,CAAC,IAAsB,mCAAI,EAAE,CAAC,CAAC,CAAC;QAEjE,IAAI,KAAK,KAAK,SAAS,IAAI,UAAU,CAAC,MAAM,IAAI,KAAK,EAAE,CAAC;YACvD,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QACnC,CAAC;QAED,IAAI,EAAE,CAAC;IACR,CAAC,QACA,YAAY,CAAC,UAAU,KAAK,SAAS;QACrC,IAAI,IAAM,YAAY,CAAC,UAA0B,CAAC,UAAqB,EACtE;IAEF,OAAO,UAAU,CAAC;AACnB,CAAC;AAED,SAAgB,eAAe,CAAC,KAAa;IAC5C,OAAO,KAAK;SACV,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;SAC5B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;AACnC,CAAC;AAED,SAAgB,gBAAgB,CAAC,MAAc;IAC9C,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodePropertyOptions, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class HostingerMail implements INodeType {
3
+ description: INodeTypeDescription;
4
+ methods: {
5
+ loadOptions: {
6
+ getMailboxes(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
7
+ getFolders(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
8
+ };
9
+ };
10
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
11
+ }