Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
courier-js
Advanced tools
Create email components with React / [react-html-email](https://github.com/chromakode/react-html-email) and send them to Mailchimp on the server.
Create email components with React / react-html-email and send them to Mailchimp on the server.
Download node at nodejs.org and install it, if you haven't already.
npm install courier-js --save
Render and return an HTML string from your email component.
import courier from 'courier';
import React from 'react';
import { Email, Item, Span } from 'react-html-email';
const template = () => (
<Email title='My Sexy Email'>
<Item data-mc-edit="article_title">
<Span>Oh my, emails are sexy now.</Span>
</Item>
</Email>
);
const allTemplates = {
myTemplate: {
template,
fileName: 'myTemplate'
}
};
const { render, templateNames } = courier({ allTemplates });
const templateProps = {};
templateNames(); // returns a string of your template names
render('myTemplate', templateProps); // returns an HTML string with your props and `mc:edit` attribute
Compile your email component to an HTML file and the directory of your choice.
import courier from 'courier';
import React from 'react';
import { Email, Item, Span } from 'react-html-email';
const action = process.argv[2];
const template = () => (
<Email title='My Sexy Email'>
<Item data-mc-edit="article_title">
<Span>Oh my, emails are sexy now.</Span>
</Item>
</Email>
);
const allTemplates = {
myTemplate: {
template,
fileName: 'myTemplate'
}
};
const { compile } = courier({ allTemplates });
const templateProps = {};
const templateProps = {};
const dir = __dirname;
compile('myTemplate', templateProps, dir); // renders your template inside `dir` with your `fileName`.html
Update a Mailchimp template and send a campaign based on your email component.
import courier from 'courier';
import React from 'react';
import { Email, Item, Span } from 'react-html-email';
const action = process.argv[2];
const template = () => (
<Email title='My Sexy Email'>
<Item data-mc-edit="article_title">
<Span>Oh my, emails are sexy now.</Span>
</Item>
</Email>
);
const allTemplates = {
myTemplate: {
template,
fileName: 'myTemplate'
}
};
const { mailchimp, render } = courier({ allTemplates });
const templateProps = {};
const mailchimpConfig = {
key: config.key,
datacenter: config.datacenter
};
const mailchimpOpts = {
campaign: {
type: 'regular',
recipients: {
list_id: 0
},
settings: {
subject_line: 'Send via Courier',
from_name: 'Sample',
reply_to: 'sample@someemail.com',
title: 'My Sexy Courier Campaign'
}
},
templateId: 0,
templateData: {
name: 'My Template Name',
html: render('myTemplate', templateProps)
}
};
/*
Also available from `mailchimp`:
updateTemplate,
createCampaign,
updateCampaignContent,
sendCampaignAction
*/
const { init } = mailchimp(mailchimpConfig, mailchimpOpts);
/*
Updates `templateId` with your rendered component
Creates new campaign
Updates campaign content with your `templateId`
Sends campaign to your list
*/
init()
.then((data) => console.log(data));
.catch((error) => console.log(error));
npm install
npm test
mc:edit
feross/standard
with semicolons sprinkled on top.MIT
Generated by package-json-to-readme
FAQs
Create email components with React / [react-html-email](https://github.com/chromakode/react-html-email) and send them to Mailchimp on the server.
The npm package courier-js receives a total of 10 weekly downloads. As such, courier-js popularity was classified as not popular.
We found that courier-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.