shellscape / jsx-email

Build emails with a delightful DX
https://jsx.email
MIT License
902 stars 28 forks source link

send mail #64

Closed sysmat closed 8 months ago

sysmat commented 8 months ago

Documentation Is:

Please Explain in Detail...

Your Proposal for Changes

import { render } from '@jsx-email/render';
import nodemailer from 'nodemailer';
import React from 'react';

import { Template as  BatmanTemplate} from './emails/BatmanEmail';

const html = render(<BatmanTemplate email="Bruce" name="Wayne" />);
const transport = nodemailer.createTransport({
  host: xxx,
  port: xxx,
...
});

await transport.sendMail({
  from: xxx,
  to: xxxx,
  subject: 'jsx-email-starter',
  html: html
}); 
shellscape commented 8 months ago

You'd only need module if you're using top level await. You can wrap the call to nodemailer in an iife, or function that's called.

jsx-email is an email rendering package. much like react-email, you have to understand how to use a third party email provider along with the package.

sysmat commented 8 months ago

@shellscape thx, yes I could avoid "type": "module", by wrapping it in function