{"id":20040447,"url":"https://github.com/postalserver/postal-node","last_synced_at":"2025-05-05T08:32:00.311Z","repository":{"id":40338703,"uuid":"88881615","full_name":"postalserver/postal-node","owner":"postalserver","description":"A Node.js library for the Postal mail platform","archived":false,"fork":false,"pushed_at":"2023-07-07T01:02:07.000Z","size":5,"stargazers_count":65,"open_issues_count":6,"forks_count":20,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-08T19:46:45.226Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/postalserver.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-20T15:29:27.000Z","updated_at":"2025-03-30T22:38:14.000Z","dependencies_parsed_at":"2024-11-13T10:42:25.165Z","dependency_job_id":"6ea9fedb-0192-45ac-b876-7c71930815d1","html_url":"https://github.com/postalserver/postal-node","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postalserver%2Fpostal-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postalserver%2Fpostal-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postalserver%2Fpostal-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postalserver%2Fpostal-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/postalserver","download_url":"https://codeload.github.com/postalserver/postal-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252466680,"owners_count":21752409,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T10:42:17.314Z","updated_at":"2025-05-05T08:32:00.027Z","avatar_url":"https://github.com/postalserver.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Postal for Node\n\nThis library helps you send e-mails through the open source mail delivery\nplatform, [Postal](https://github.com/atech/postal) in Node.\n\n## Installation\n\nInstall the library using [NPM](https://www.npmjs.com/):\n\n```\n$ npm install @atech/postal --save\n```\n\n## Usage\n\nSending an email is very simple. Just follow the example below. Before you can\nbegin, you'll need to login to your installation's web interface and generate\nnew API credentials.\n\n```javascript\n// Include the Postal library\nvar Postal = require('@atech/postal');\n\n// Create a new Postal client using a server key generated using your\n// installation's web interface\nvar client = new Postal.Client('https://postal.yourdomain.com', 'your-api-key');\n\n// Create a new message\nvar message = new Postal.SendMessage(client);\n\n// Add some recipients\nmessage.to('john@example.com');\nmessage.to('mary@example.com');\nmessage.cc('mike@example.com');\nmessage.bcc('secret@awesomeapp.com');\n\n// Specify who the message should be from - this must be from a verified domain\n// on your mail server\nmessage.from('test@test.postal.io');\n\n// Set the subject\nmessage.subject('Hi there!');\n\n// Set the content for the e-mail\nmessage.plainBody('Hello world!');\nmessage.htmlBody('\u003cp\u003eHello world!\u003c/p\u003e');\n\n// Add any custom headers\nmessage.header('X-PHP-Test', 'value');\n\n// Attach any files\nmessage.attach('textmessage.txt', 'text/plain', 'Hello world!');\n\n// Send the message and get the result\nmessage.send()\n  .then(function (result) {\n    var recipients = result.recipients();\n    // Loop through each of the recipients to get the message ID\n    for (var email in recipients) {\n      var message = recipients[email];\n      console.log(message.id());    // Logs the message ID\n      console.log(message.token()); // Logs the message's token\n    }\n  }).catch(function (error) {\n    // Do something with the error\n    console.log(error.code);\n    console.log(error.message);\n  });\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostalserver%2Fpostal-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpostalserver%2Fpostal-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostalserver%2Fpostal-node/lists"}