# Stacks SMS Stacks Email is driver system for sending Emails. ## โ˜˜๏ธ Features - ๐Ÿ“ฆ Send Email ## ๐Ÿค– Usage ```bash bun install -d @stacksjs/email ``` You may now use it in your project: ```ts import * as email from '@stacksjs/email' /* Then choose a driver. E.g for sendgrid */ const notification = email.sendgrid notification.send(EmailOptions) interface EmailOptions { to: string | string[] subject: string html: string from?: string text?: string attachments?: AttachmentOptions[] id?: string } ``` ### Drivers Drivers are configured with the following environment variables: #### Sendgrid ```bash SENDGRID*API*KEY=SG123 SENDGRID*FROM=from@example.com SENDGRID*SENDER*NAME=Sender ``` #### Mailgun ```bash MAILGUN*API*KEY=MG123 MAILGUN*DOMAIN=example.com MAILGUN*USERNAME=username MAILGUN*FROM=from@example.com ``` #### Mailjet ```bash MAILJET*API*KEY=MJ123 MAILJET*API*SECRET=MJTESTSECRET MAILJET*FROM*EMAIL=from@example.com ``` #### Netcore ```bash NETCORE*API*KEY=NC123 NETCORE*FROM=from@example.com ``` #### Nodemailer ```bash NODEMAILER*FROM*EMAIL=from@example.com NODEMAILER*HOST=example.com NODEMAILER*USERNAME=username NODEMAILER*PASSWORD=password NODEMAILER*PORT=25 NODEMAILER*SECURE=true ``` #### Postmark ```bash POSTMARK*API*KEY=PM123 POSTMARK*FROM=from@example.com ``` #### AWS SES ```bash SES*REGION=US SES*ACCESS*KEY*ID=testkey123 SES*SECRET*ACCESS*KEY=testaccesskey123 SES*FROM=from@example.com ``` #### Mandrill ```bash MANDRILL*API*KEY=Ma123 MANDRILL*EMAIL=from@example.com ``` #### EmailJS ```bash EMAILJS*FROM*EMAIL=from@example.com EMAILJS*HOST=example.com EMAILJS*USERNAME=username EMAILJS*PASSWORD=password EMAILJS*PORT=25 EMAILJS*SECURE=true ``` Learn more in the docs. ## ๐Ÿงฑ Email components (`` & co.) Bundled stx components for composing Outlook / Gmail-safe HTML in `resources/components/Email/`. Drop them into any `.stx` template; the framework auto-discovers them when rendering through `@stacksjs/email`'s `template()` helper. | Component | Slot/content | Notable props | |---|---|---| | `` | default + `head`/`header`/`footer` slots | `title`, `width` (px), `bodyBg`, `contentBg` | | `` | default | `padding`, `background` | | `` | default | `size` (`sm`/`md`/`lg`/`heading`), `align`, `color`, `spacing` | | `` | default = button label | `href` (required), `color`, `bg`, `padX`, `padY` | | `` | none | `color`, `spacing` | | `` | none | `src` (required), `alt` (required), `width`, `height`, `display` | | `` | default | `href` (required), `color`, `underline` | Each one renders bulletproof table-based markup with inline styles so it works in Outlook 2007-2019, Gmail (web + Android), and Apple Mail without an inliner pass. Example: ```stx Welcome aboard, {{ userName }}! Thanks for signing up โ€” here's a button to get started: Open the app Reply to this email if you have questions. ``` The bundled `welcome.stx`, `password-reset.stx`, `password-changed.stx`, and `email-verification.stx` are written using these components โ€” they double as worked examples. Copy + edit for app-specific designs. ## ๐ŸŽจ CSS inlining Gmail (especially the Android app) and older Outlook clients strip or ignore `` โ€” those blocks pass through untouched. Useful for `@media`-queried responsive rules that aren't inline-friendly anyway. The inliner handles class / id / tag / chained selectors (`.btn`, `#cta`, `p`, `a.btn`, `.btn.primary`). Selectors with descendant combinators, pseudo-classes, or `@media` queries stay in a slimmed `