{"library":"sendmail","title":"Node.js Sendmail Utility","description":"The `sendmail` package for Node.js provides a direct method for sending emails without relying on an external SMTP server. Instead, it resolves MX records for recipient domains and attempts to deliver mail directly. The current stable version is 1.6.1, though development appears to have ceased, with the last significant update converting to ES2015 in version 1.2.0. This library uses `mailcomposer` internally to handle email formatting, supporting HTML content, attachments, and DKIM signing. It also features a development mode for local testing without sending actual emails. Its primary differentiator is the direct delivery approach, contrasting with libraries that typically require SMTP relay configuration, making it suitable for specific application architectures or testing scenarios where a full SMTP setup is not desired.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install sendmail"],"cli":null},"imports":["const sendmail = require('sendmail')();","const sendmail = require('sendmail')({ silent: true });","import sendmailFactory from 'sendmail';\nconst sendmail = sendmailFactory();"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import sendmailFactory from 'sendmail';\n\n// Configure sendmail. In a real app, use environment variables for sensitive data.\n// Use devPort and devHost for local testing without sending actual emails.\nconst sendmail = sendmailFactory({\n  logger: {\n    debug: console.log,\n    info: console.info,\n    warn: console.warn,\n    error: console.error\n  },\n  silent: false, // Set to true to suppress console output\n  devPort: 1025, // For development mode, e.g., use with MailHog or similar local SMTP server\n  devHost: 'localhost' // Host for development mode\n});\n\n// Send an email\nsendmail({\n  from: 'your-app@yourdomain.com',\n  to: 'recipient@example.com',\n  subject: 'Hello from Node-Sendmail!',\n  html: '<h1>Welcome!</h1><p>This is a test email sent without an SMTP server.</p>',\n  // You can also add attachments:\n  // attachments: [{\n  //   filename: 'text1.txt',\n  //   content: 'hello world!'\n  // }]\n}, function(err, reply) {\n  if (err) {\n    console.error('Email sending failed:', err && err.stack);\n  } else {\n    console.log('Email sent successfully:', reply);\n  }\n});","lang":"typescript","description":"Demonstrates initializing `sendmail` with basic logging and development mode settings, then sending a simple HTML email with error handling. Uses ESM import style for modern Node.js environments.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}