Socket
Book a DemoInstallSign in
Socket

larvitmail

Package Overview
Dependencies
Maintainers
8
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

larvitmail

nodemailer wrapper

latest
Source
npmnpm
Version
3.0.146
Version published
Weekly downloads
156
9.86%
Maintainers
8
Weekly downloads
 
Created
Source

Build Status

larvitmail

Mailer wrapper for nodejs

Installation

npm i larvitmail

Usage

Basic usage

Defaults to SMTP localhost without any options.

send() returns SentMessageInfo from nodemailer (https://nodemailer.com/usage/) where messageId, envelope, acceppted, rejected etc. can be found.

const Mail = require('larvitmail');
const mail = new Mail();

await mail.send({
	'from':	'foo@bar.com',
	'to':	'someone@someplace.com',
	'subject':	'test',
	'text':	'BAM!'
}; // throws on error
console.log('Mail sent');

Custom configuration

const Mail = require('larvitmail');
const mail = new Mail({
	'log': new require('larvitutils').Log('verbose'),
	'transportConf': 'smtps://user%40gmail.com:pass@smtp.gmail.com',
	'mailDefaults': {
		'from': 'foo@bar.com'
	}
});

await mail.send({
	'to':	'someone@someplace.com',
	'subject':	'test',
	'text':	'BAM!'
};
console.log('Mail sent');

Templates

Set "isHtml" to true to use templates to send html emails.

const Mail = require('larvitmail');
const mail = new Mail();

await mail.send({
	to:	'someone@someplace.com',
	subject:	'test',
	template:	'<h1>Hello <%= name %>!</h1>',
	templateData:	{ 'name': 'bar' },
	isHtml:	true
};
console.log('Mail sent');

Changelog

3.0.0

  • Replaced callback with promises
  • Upped lib versions

Keywords

email

FAQs

Package last updated on 10 Nov 2025

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