bext-plugin-email
Transactional email with React templates and SMTP/SES.
Send transactional emails from your bext app using React components as templates. Supports SMTP (any provider) and Amazon SES. Includes a local preview server for development.
Install
bext plugin add emailConfig
[plugins.email]
from = "hello@example.com"[plugins.email.smtp] host = "smtp.example.com" port = 587 username = "$SMTP_USER" password = "$SMTP_PASS" ```
Sending
Import the `send` function in your route handlers:
import { send } from "bext:email";await send({ to: user.email, subject: "Welcome!", react: WelcomeEmail({ name: user.name }), }); ```
Templates
Email templates are React components that render to HTML. Use standard JSX:
export default function WelcomeEmail({ name }: { name: string }) {
return (
<div style={{ fontFamily: "sans-serif", padding: "2rem" }}>
<h1>Welcome, {name}!</h1>
<p>Your account is ready.</p>
</div>
);
}Local preview
During development, emails are rendered in the browser at `/_email/preview` instead of being sent. Configure which template to preview in the URL: `/_email/preview/welcome?name=Alice`.