
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
react-letter
Advanced tools
Supply Chain Security
Vulnerability
Quality
Maintenance
License
react-letter is a React.js component that allows for an easy display of HTML e-mail content with automatic sanitization. Support for features should match what is supported by Gmail.
Features:
<style>
support.The component itself is parser-agnostic, and can be used with any RFC 822 parser as long as it provides HTML or text output. The sanitization is done on the client-side using DOMParser with some security features targeting older browsers (although there's no guarantee of full functionality under browser versions older than 5 years).
Check other TypeScript e-mail projects:
Parser | Inbound SMTP |
---|---|
letterparser | microMTA |
react-letter is available on NPM, and can be installed with either npm or yarn:
yarn add react-letter
A Vue.js version is also available: vue-letter.
See: Example or play in the CodeSandbox.
react-letter can be used with letterparser (currently in development, but it's the only RFC 822 parser with browser support as far as I know) or any other parser like this:
import { Letter } from 'react-letter';
import { extract } from 'letterparser';
const { html, text } = extract(`Date: Wed, 01 Apr 2020 00:00:00 -0000
From: A <a@example.com>
To: B <b@example.com>
Subject: Hello world!
Mime-Version: 1.0
Content-Type: text/html; charset=utf-8
Some message.`);
// No sanitization needs to be performed beforehand,
// react-letter takes care of sanitizing the input.
<Letter html={html} text={text} />;
Letter
supports the following properties:
Should the HTML be wrapped in an iframe. Default: false
.
Iframe title, usually set to subject of the message.
The result of this function will be used to rewrite the URLs for url(...) in CSS and src attributes in HTML.
The result of this function will be used to rewrite the URLs for href attributes in HTML.
List of allowed URL schemas. Default: ['http', 'https', 'mailto']
.
Preserves CSS priority (!important), default: true
.
Class name of the wrapper div.
FAQs
Display e-mail messages in your React projects.
The npm package react-letter receives a total of 10,354 weekly downloads. As such, react-letter popularity was classified as popular.
We found that react-letter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.