Socket
Socket
Sign inDemoInstall

sendmail

Package Overview
Dependencies
10
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sendmail

Sendmail without setting up SMTP server


Version published
Maintainers
2
Install size
1.63 MB
Created

Readme

Source

npm downloads npm-issues js-standard-style

node-sendmail

Send mail without SMTP server

Install

npm install sendmail --save

Options

var sendmail = require('sendmail')({
  logger: {
    debug: console.log,
    info: console.info,
    warn: console.warn,
    error: console.error
  },
  silent: false,
  dkim: { // Default: False
    privateKey: fs.readFileSync('./dkim-private.pem', 'utf8'),
    keySelector: 'mydomainkey'
  },
  devPort: 1025 // Default: False
})

Usage

var sendmail = require('sendmail')();

sendmail({
    from: 'no-reply@yourdomain.com',
    to: 'test@qq.com, test@sohu.com, test@163.com ',
    subject: 'test sendmail',
    html: 'Mail of test sendmail ',
  }, function(err, reply) {
    console.log(err && err.stack);
    console.dir(reply);
});

Examples

Please checkout our great examples

Upgrading

Note if you were on any previous version before <1.0.0 You will need to start using html instead of content. Instead of creating emails ourselves anymore we have decided to use mailcomposer to compose our emails. Which means we can give you the same great package with the best mail composer package out there.

Mail Options

Note we use mailcomposer to compose our mail before we send it out so all mail options will be well documented Here. But for those who want something particular go ahead and search down below.

E-mail message fields

Below are a list of the most used options for email fields. Please read the entire list of options here Here:

  • from
  • sender
  • to
  • cc
  • bcc
  • replyTo
  • inReplyTo
  • subject
  • text
  • html
Attachments

You are also able to send attachents. Please review the list of properties here Here

Alternatives

In addition to text and HTML, any kind of data can be inserted as an alternative content of the main body. Please check that out Here

Address Formatting

All e-mail addresses can be formatted. Please check that out Here

SMTP envelope

SMTP envelope is usually auto generated from from, to, cc and bcc fields but you can change them Here

Using Embedded Images

Attachments can be used as embedded images in the HTML body. To use this feature, you need to set additional properties Here

Questions, Comments & Concerns

Please reach out to Green Pioneer. Guileen is the original creator.

Change Log

1.0.0 Mail Composer

A better way to compose the emails while still sending them out in the exact same way.

1.1.0 Support for development SMTP

A property describing a port for a local SMTP server (see MailHog) was added. If the property is omitted, sendmail behaves like it used to. This feature makes it possible to test an application offline and for multiple email addresses without needing to create hundreds of mail accounts. - Special thanks goes out to gumannp for PR 21

1.1.0 Add DKIM signing

Added a dkim object to options that can have two properties: privateKey and keySelector. These options correspond to the options for dkim-signer. Added an example for these options. Special thanks goes out to download13 for PR 23

Roadmap

  • Add Testing
  • Please submit what you think should be in the plan

Keywords

FAQs

Last updated on 06 Dec 2016

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc