🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

sendmail

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sendmail

Sendmail without setting up SMTP server

1.6.1
latest
Source
npm
Version published
Weekly downloads
223K
2.56%
Maintainers
2
Weekly downloads
 
Created

What is sendmail?

The sendmail npm package is a simple way to send emails from your Node.js application without needing a dedicated SMTP server. It uses the sendmail command available on Unix-like systems to send emails.

What are sendmail's main functionalities?

Send a basic email

This feature allows you to send a basic email with a subject and HTML content. The sendmail function is called with an options object containing the email details.

const sendmail = require('sendmail')();
sendmail({
  from: 'no-reply@yourdomain.com',
  to: 'user@example.com',
  subject: 'Test Email',
  html: 'This is a test email',
}, function(err, reply) {
  console.log(err && err.stack);
  console.dir(reply);
});

Send an email with attachments

This feature allows you to send an email with attachments. The attachments property is an array of objects, each representing a file to be attached to the email.

const sendmail = require('sendmail')();
sendmail({
  from: 'no-reply@yourdomain.com',
  to: 'user@example.com',
  subject: 'Test Email with Attachment',
  html: 'This is a test email with an attachment',
  attachments: [
    {   // file on disk as an attachment
      filename: 'text1.txt',
      path: '/path/to/file.txt' // stream this file
    }
  ]
}, function(err, reply) {
  console.log(err && err.stack);
  console.dir(reply);
});

Other packages similar to sendmail

Keywords

email sender

FAQs

Package last updated on 05 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts