Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mailcomposer

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailcomposer

Compose E-Mail messages

  • 3.5.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
86K
decreased by-65.16%
Maintainers
1
Weekly downloads
 
Created

What is mailcomposer?

The mailcomposer npm package is a tool for creating email messages with various features such as attachments, HTML content, and custom headers. It is useful for generating email content that can be sent using an SMTP client or other email transport methods.

What are mailcomposer's main functionalities?

Basic Email Composition

This feature allows you to compose a basic email with a sender, receiver, subject, and plain text content.

const MailComposer = require('mailcomposer');
const mail = new MailComposer({
  from: 'sender@example.com',
  to: 'receiver@example.com',
  subject: 'Hello',
  text: 'Hello world!'
});
mail.build((err, message) => {
  if (err) {
    console.error('Error:', err);
  } else {
    console.log('Email message:', message.toString());
  }
});

HTML Email Composition

This feature allows you to compose an email with HTML content, which can include rich text formatting and images.

const MailComposer = require('mailcomposer');
const mail = new MailComposer({
  from: 'sender@example.com',
  to: 'receiver@example.com',
  subject: 'Hello',
  html: '<h1>Hello world!</h1>'
});
mail.build((err, message) => {
  if (err) {
    console.error('Error:', err);
  } else {
    console.log('Email message:', message.toString());
  }
});

Attachments

This feature allows you to add attachments to your email, such as files or images.

const MailComposer = require('mailcomposer');
const mail = new MailComposer({
  from: 'sender@example.com',
  to: 'receiver@example.com',
  subject: 'Hello',
  text: 'Hello world!',
  attachments: [
    {
      filename: 'text.txt',
      content: 'Hello world!'
    }
  ]
});
mail.build((err, message) => {
  if (err) {
    console.error('Error:', err);
  } else {
    console.log('Email message:', message.toString());
  }
});

Custom Headers

This feature allows you to add custom headers to your email, which can be useful for various purposes such as tracking or custom processing.

const MailComposer = require('mailcomposer');
const mail = new MailComposer({
  from: 'sender@example.com',
  to: 'receiver@example.com',
  subject: 'Hello',
  text: 'Hello world!',
  headers: {
    'X-Custom-Header': 'Custom header value'
  }
});
mail.build((err, message) => {
  if (err) {
    console.error('Error:', err);
  } else {
    console.log('Email message:', message.toString());
  }
});

Other packages similar to mailcomposer

Keywords

FAQs

Package last updated on 06 Feb 2016

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc