
Research
/Security News
Popular Tinycolor npm Package Compromised in Supply Chain Attack Affecting 40+ Packages
Malicious update to @ctrl/tinycolor on npm is part of a supply-chain attack hitting 40+ packages across maintainers
coins-mail
Advanced tools
HTML and text email templates for COINS.
The createMail
is coins-mail’s chief export. It expects a configured Bookshelf.js model:
const knex = require('knex')({
/* DB config ... */
});
const bookshelf = require('bookshelf')(knex);
const createMail = require('coins-mail').createMail;
const MyMailModel = bookshelf.Model.extend({
tableName: 'my_table_name',
});
createMail(MyMailModel, options); // returns Promise
createMail
returns a Promise. In the case of a single mail option, this is the result of calling save
on a Bookshelf.js model. In the case of a collection of mail options, this is the result of invoking save
on the Bookshelf collection.
options
can be either a mail options object or a collection of these objects:
fromLabel
(string): Added to the from_label
column. This is typically the name of application sending the email.recipients
(string or array of strings): Single recipient email address or a collection of email addresses.replyTo
(string): Email address to use in the email’s 'reply to' field.subject
(string): Email’s subject field.templateLocals
(object): Hash to pass to getTemplate
. The keys/values depend on the email template in use (see templateName
).sendTime
(string, defaults to Date.now()
): Time to send the email.templateName
(string, defaults to “default“): Name of email template to use. createMail(MyMailModel, {
fromLabel: 'Test Application',,
recipients: [
'recipient-1@mrn.org',
'recipeint-2@mrn.org',
'recipient-3@mrn.org',
// ...
],
replyTo: 'reply-address@mrn.org',
sendTime: Date.now() + 24 * 60 * 60 * 1000,
subject: 'Test Subject',
templateLocals: {
html: {
myHtmlTemplateVar: 'value',
},
text: {
myTextTemplateVar: 'value',
},
},
templateName: 'my-template',
})
.then(savedModel => console.log(savedModel))
.catch(error => console.error(error));
createMail(MyMailModel, [{
fromLabel: 'Test Application 1',
recipients: 'recipient-1@mrn.org'
replyTo: 'reply-address@mrn.org',
subject: 'Test Subject 1',
templateLocals: // ...
}, {
fromLabel: 'Test Application 2',
recipients: 'recipient-2@mrn.org'
replyTo: 'reply-address@mrn.org',
subject: 'Test Subject 2',
templateLocals: // ...
}, {
fromLabel: 'Test Application 3',
recipients: 'recipient-3@mrn.org'
replyTo: 'reply-address@mrn.org',
subject: 'Test Subject 3',
templateLocals: // ...
}])
.then(savedModels => {
savedModels.forEach(savedModel => console.log(savedModel));
})
.catch(error => console.error(error));
const getTemplate = require('coins-mail').getTemplate;
getTemplate({
html: {
myHtmlTemplateVar: '<h1>Hi!</h1> <p>Insert this html…</p>',
},
text: {
myTextTemplateVar: 'Alternative!\n\nFor the text version…',
},
}, (error, result) => {
if (error) {
console.error(error);
} else {
console.log('HTML:', result.html);
console.log('Text:', result.text);
}
});
getTemplate
also returns a Promise
:
getTemplate(myLocals)
.then(result => {
console.log('HTML:', result.html);
console.log('Text:', result.text);
})
.catch(error => console.error(error));
MIT. See LICENSE for details.
FAQs
HTML and text email templates for COINS.
The npm package coins-mail receives a total of 0 weekly downloads. As such, coins-mail popularity was classified as not popular.
We found that coins-mail demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 open source maintainers collaborating on the project.
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.
Research
/Security News
Malicious update to @ctrl/tinycolor on npm is part of a supply-chain attack hitting 40+ packages across maintainers
Security News
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.