# Newsletter — email newsletters

> The official Newsletter plugin — a subscribe form on your pages, email confirmation (double opt-in), an unsubscribe link in every email, list import and export, and campaigns sent gradually within the email quota

Source: https://anasaki.live/docs/en/store/plugin-newsletter

The **Newsletter** plugin (`newsletter`) keeps your subscriber list and sends email campaigns from your own site, with no outside service.

Needs Anasaki Studio 2.2.2 or later, with **Site settings → Email** set up first.

## Collecting subscribers

Place the **Subscribe form** block in the designer (set the heading, description, button text and optionally ask for a name) — or POST your own form to `/newsletter/subscribe` (fields `email`, `name`).

With **Confirm email before subscribing** on (the default), subscribers get an email with a confirmation link and receive news only after confirming — this stops people signing up someone else's address and keeps your site's email out of spam folders.

## Sending a campaign

1. The **Newsletter** page (developer menu → plugin pages) → the **Campaigns** tab → **New campaign**
2. Enter the subject and message — a blank line starts a new paragraph, and `https://` links become clickable
3. **Send a test to me** to see how it looks in your inbox
4. **Send to all subscribers** — the system sends gradually in the background; see the progress (sent / failed) in the campaign list

Every email has the **footer** you set and always an **Unsubscribe** link.

> [!WARNING]
> The site sends email within its overall quota (default 100 emails/hour, set under **Site Code → Settings**). Set the plugin's **Maximum emails per hour** below that quota to leave room for the site's other email (password resets, order notifications etc.) — a large list takes hours to send. For tens of thousands of emails, use the SMTP of an email delivery service such as SendGrid or Amazon SES.

## Managing the list

The **Subscribers** tab is split into subscribed / pending / unsubscribed. Search by email or name, delete, **Export CSV**, and **Add subscribers** by pasting `email,name` lines (added as &#34;subscribed&#34; right away — only for people who already consented under PDPA).

## Unsubscribing

The email link opens an &#34;Unsubscribe&#34; page with a confirm button (so email link scanners cannot unsubscribe on the reader's behalf). Unsubscribed people don't get the next campaigns, and signing up again needs a new confirmation.

## For developers

```ts
site.on('newsletter.subscribed', (s) => log.info('subscriber', s.email));
plugins.call('newsletter', 'subscribe', 'buyer@example.com', 'Somchai'); // e.g. from the checkout
```

Events `newsletter.subscribed` `newsletter.unsubscribed` `newsletter.sent`; tables `p_newsletter_subscribers` `p_newsletter_campaigns`.
