Oy-vey: React Email Templates

0.12.1 · abandoned · verified Tue Apr 21

Oy-vey is a utility library for building server-side HTML email templates using React. It provides a set of components (`Table`, `TBody`, `TR`, `TD`, `Img`, `A`) that validate props against email best practices to help ensure compatibility across various email clients. The package also offers `Oy.renderTemplate` to inject rendered React components into a complete HTML email skeleton. Currently at version 0.12.1, the project appears to be largely abandoned, with the last npm publish over five years ago and known, unaddressed issues such as significant TypeScript compilation time increases. Its primary differentiation lies in its React-based component validation for email best practices, but it lacks active development and modern ecosystem support.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates rendering a simple React email component using Oy-vey and serving it via an Express.js endpoint.

import express from 'express';
import React from 'react';
import Oy from 'oy-vey';

const MyEmailTemplate = ({ username }) => {
  const { Table, TBody, TR, TD } = Oy;
  return (
    <Table width="100%" border="0" cellPadding="0" cellSpacing="0">
      <TBody>
        <TR>
          <TD align="center" style={{ padding: '20px' }}>
            <h1>Hello, {username}!</h1>
            <p>This is a test email rendered with Oy-vey and React.</p>
            <a href="https://example.com" style={{ color: '#1a73e8' }}>Visit our site</a>
          </TD>
        </TR>
      </TBody>
    </Table>
  );
};

const server = express();
server.set('port', (process.env.PORT || 8887));

server.get('/email/hello', (req, res) => {
  const template = Oy.renderTemplate(<MyEmailTemplate username="Developer" />, {
    title: 'Welcome Email',
    previewText: 'A quick intro to our service.',
    headCSS: 'body { font-family: sans-serif; }',
    bgColor: '#f0f0f0'
  });
  res.send(template);
});

server.listen(server.get('port'), () => {
  console.log('Node server is running on port', server.get('port'));
});

view raw JSON →