{"library":"node-mailjet","title":"Mailjet Node.js SDK","description":"The `node-mailjet` library is the official JavaScript SDK for interacting with the Mailjet Email and SMS APIs. Currently at stable version 6.0.11, the package demonstrates an active maintenance schedule with frequent patch releases addressing bug fixes and critical dependency updates, such as those for `axios` to mitigate security vulnerabilities. While major version releases are less frequent, the library ensures ongoing compatibility and performance. A key differentiator is its versatility, allowing usage in both Node.js server-side environments and client-side browser applications, though browser usage necessitates a proxy due to Cross-Origin Resource Sharing (CORS) limitations and careful handling of API keys. It offers comprehensive TypeScript typings out-of-the-box, simplifying development and improving type safety. The SDK facilitates sending emails, managing contacts, and interacting with other Mailjet API endpoints, providing a robust interface for transactional and marketing communication.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install node-mailjet"],"cli":null},"imports":["const Mailjet = require('node-mailjet');","import { Client } from 'node-mailjet';","import type { SendParams } from 'node-mailjet';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { Client } from 'node-mailjet';\n\nconst mailjet = new Client({\n  apiKey: process.env.MJ_APIKEY_PUBLIC ?? 'your-api-key',\n  apiSecret: process.env.MJ_APIKEY_PRIVATE ?? 'your-api-secret'\n});\n\nasync function sendExampleEmail() {\n  try {\n    const request = mailjet\n      .post('send', { version: 'v3.1' })\n      .request({\n        Messages: [\n          {\n            From: {\n              Email: 'sender@example.com',\n              Name: 'Your Name'\n            },\n            To: [\n              {\n                Email: 'recipient@example.com',\n                Name: 'Recipient Name'\n              }\n            ],\n            Subject: 'Greetings from Mailjet!',\n            TextPart: 'My first Mailjet email',\n            HTMLPart: '<h3>Dear passenger, welcome to Mailjet!</h3><br />May the delivery force be with you!',\n            CustomID: 'AppGettingStartedTest'\n          }\n        ]\n      });\n\n    const result = await request;\n    console.log('Email sent successfully:', result.body.Messages[0].Status);\n  } catch (error: any) {\n    console.error('Failed to send email:', error.statusCode, error.response.body);\n  }\n}\n\nsendExampleEmail();","lang":"typescript","description":"Demonstrates how to initialize the Mailjet client and send a simple transactional email using the v3.1 Send API.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}