{"id":13727301,"url":"https://github.com/mat-sz/react-letter","last_synced_at":"2025-04-04T06:08:55.654Z","repository":{"id":57333873,"uuid":"253574046","full_name":"mat-sz/react-letter","owner":"mat-sz","description":"✉️ Display e-mails in your React.js projects. (Targets Gmail rendering.)","archived":false,"fork":false,"pushed_at":"2023-10-02T16:38:10.000Z","size":398,"stargazers_count":275,"open_issues_count":3,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-28T05:09:17.098Z","etag":null,"topics":["email","gmail","javascript","javascript-library","react","reactjs","reactjs-component","typescript","typescript-library"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause-clear","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mat-sz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-04-06T17:50:10.000Z","updated_at":"2025-03-14T10:12:48.000Z","dependencies_parsed_at":"2023-10-02T21:18:29.880Z","dependency_job_id":null,"html_url":"https://github.com/mat-sz/react-letter","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mat-sz%2Freact-letter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mat-sz%2Freact-letter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mat-sz%2Freact-letter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mat-sz%2Freact-letter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mat-sz","download_url":"https://codeload.github.com/mat-sz/react-letter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247128744,"owners_count":20888235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["email","gmail","javascript","javascript-library","react","reactjs","reactjs-component","typescript","typescript-library"],"created_at":"2024-08-03T01:03:48.783Z","updated_at":"2025-04-04T06:08:55.639Z","avatar_url":"https://github.com/mat-sz.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/mat-sz/react-letter/master/logo.png\" alt=\"react-letter\" width=\"700\"\u003e\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg alt=\"workflow\" src=\"https://img.shields.io/github/actions/workflow/status/mat-sz/react-letter/node.js.yml?branch=master\"\u003e\n\u003ca href=\"https://npmjs.com/package/react-letter\"\u003e\n\u003cimg alt=\"npm\" src=\"https://img.shields.io/npm/v/react-letter\"\u003e\n\u003cimg alt=\"npm\" src=\"https://img.shields.io/npm/dw/react-letter\"\u003e\n\u003cimg alt=\"NPM\" src=\"https://img.shields.io/npm/l/react-letter\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n**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.\n\nFeatures:\n\n- `\u003cstyle\u003e` support.\n- Automatic removal of relative URLs.\n- Support for rewriting the link and resource URLs to increase user's privacy and security.\n- Prefixing classes and IDs to prevent clashing with page styles.\n- Wrapping contents in an iframe (as an option).\n- First-class TypeScript support (the entire library is written in TypeScript), along with [a related RFC 822 parser project](https://github.com/mat-sz/letterparser) also written in TypeScript.\n- Only one dependency ([lettersanitizer](https://github.com/mat-sz/lettersanitizer)).\n\nThe 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).\n\n**Check other TypeScript e-mail projects:**\n\n| Parser                                                 | SMTP client/server                                 |\n| ------------------------------------------------------ | -------------------------------------------------- |\n| [letterparser](https://github.com/mat-sz/letterparser) | [@typemail/smtp](https://github.com/typemail/smtp) |\n\n## Installation\n\n**react-letter** is [available on NPM](https://npmjs.com/package/react-letter), and can be installed with either npm or yarn:\n\n```\nyarn add react-letter\n```\n\n**A Vue.js version is also available: [vue-letter](https://github.com/mat-sz/vue-letter).**\n\n## Usage\n\nSee: [Example](https://github.com/mat-sz/react-letter/tree/master/example) or play in the [CodeSandbox](https://codesandbox.io/s/react-letter-basic-example-6lu9i).\n\nreact-letter can be used with [letterparser](https://github.com/mat-sz/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:\n\n```ts\nimport { Letter } from 'react-letter';\nimport { extract } from 'letterparser';\n\nconst { html, text } = extract(`Date: Wed, 01 Apr 2020 00:00:00 -0000\nFrom: A \u003ca@example.com\u003e\nTo: B \u003cb@example.com\u003e\nSubject: Hello world!\nMime-Version: 1.0\nContent-Type: text/html; charset=utf-8\n\nSome message.`);\n\n// No sanitization needs to be performed beforehand,\n// react-letter takes care of sanitizing the input.\n\u003cLetter html={html} text={text} /\u003e;\n```\n\n## Configuration\n\n`Letter` supports the following properties:\n\n### useIframe?: boolean;\n\nShould the HTML be wrapped in an iframe. Default: `false`.\n\n### iframeTitle?: string;\n\nIframe title, usually set to subject of the message.\n\n### rewriteExternalResources?: (url: string) =\u003e string;\n\nThe result of this function will be used to rewrite the URLs for url(...) in CSS and src attributes in HTML.\n\n### rewriteExternalLinks?: (url: string) =\u003e string;\n\nThe result of this function will be used to rewrite the URLs for href attributes in HTML.\n\n### allowedSchemas?: string[];\n\nList of allowed URL schemas. Default: `['http', 'https', 'mailto']`.\n\n### preserveCssPriority?: boolean;\n\nPreserves CSS priority (!important), default: `true`.\n\n### className?: string;\n\nClass name of the wrapper div.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmat-sz%2Freact-letter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmat-sz%2Freact-letter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmat-sz%2Freact-letter/lists"}