> For the complete documentation index, see [llms.txt](https://codemash.gitbook.io/codemash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codemash.gitbook.io/codemash/cloud/emails.md).

# Email

Send transactional and marketing emails from your project — templates, campaigns, and the provider that delivers them.

The Email module sends emails from your project — one at a time from a trigger, or to many people at once as a campaign. You write a template once, connect a provider once (AWS SES, Twilio SendGrid, Mailgun, any SMTP server), and every send — from Cloud, a trigger or your own code — uses them. Transactional emails (receipts, security) and marketing emails (newsletters) are kept apart, so a recipient can unsubscribe from marketing and still get their receipts.

## Enable the module

Open a project and choose **Email** in the left menu. While the module is off, Cloud shows this page; press **ENABLE**. You need `email:manage` (built-in **Administrator**).

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-b88917c846233e2c643c9aa6b74c6593e00bf982%2Fenable-1.png?alt=media" alt="The Email enable page: Send Emails That Drive Results with: Norbix Email Notifications, three feature cards, ENABLE and Learn more"><figcaption><p>Email → enable page, shown while the module is off.</p></figcaption></figure>

After **ENABLE**, Cloud opens **Email → Campaigns**, and the Email menu appears. Norbix also creates a `Default` signature, a `Default` footer and the Fake integration **Test Me** (the default), so you can try everything without sending real mail. To turn the module off again, see [Settings](/codemash/cloud/emails/settings.md).

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-de56777e194e18d980947fb2e11fe9db593ee250%2Fenable-2.png?alt=media" alt="Email Campaigns right after ENABLE, with the Email menu: Campaigns, Templates, Signatures, Footers, Integrations, Settings"><figcaption><p>After ENABLE: the Campaigns screen and the Email menu.</p></figcaption></figure>

## Module map

| Screen                                                 | What it is for                                                                     |
| ------------------------------------------------------ | ---------------------------------------------------------------------------------- |
| [Campaigns](/codemash/cloud/emails/campaigns.md)       | Send one template to many recipients now or later; follow every batch and message. |
| [Templates](/codemash/cloud/emails/templates.md)       | The subject and MJML body per language, with tokens; Marketing or Transactional.   |
| [Signatures](/codemash/cloud/emails/signatures.md)     | Reusable sender blocks your templates insert.                                      |
| [Footers](/codemash/cloud/emails/footers.md)           | Reusable bottom blocks, usually with the preferences and unsubscribe links.        |
| [Integrations](/codemash/cloud/emails/integrations.md) | The providers that deliver the mail, the default one, and their tests.             |
| [Settings](/codemash/cloud/emails/settings.md)         | Turn the module off.                                                               |

Not in the menu: the [preferences and unsubscribe pages](/codemash/cloud/emails/preferences.md) your recipients open from a marketing email.

## Your first email

1. [Check the integration](/codemash/cloud/emails/integrations.md) — **Test Me** (Fake) is the default; [connect a real provider](/codemash/cloud/emails/integrations/providers.md), [test it](/codemash/cloud/emails/integrations/test.md) and [set it as default](/codemash/cloud/emails/integrations/set-default.md) when you want real mail.
2. [Create a template](/codemash/cloud/emails/templates/editor.md) — for example `Welcome email`, with a translation for every project language.
3. [Send a test](/codemash/cloud/emails/templates/test-send.md) — **Test** in the editor sends it to you.
4. [Create a campaign and send it](/codemash/cloud/emails/campaigns/new.md) — pick the recipients and the template, press **Send**.
5. [Read the message log](/codemash/cloud/emails/campaigns/log.md) — the email exactly as it went out.

**Email from a trigger.** Email has no triggers of its own: a **Send Email** action in a Membership, Database, Files or Payments trigger sends a template with the same fields as a campaign (template, provider, language, on behalf of). A trigger run that cannot produce its email — the template misses a project language, the provider was disabled — sends nothing and marks the trigger **Needs attention** in its module's trigger list. See [Triggers](/codemash/cloud/concepts/triggers.md).

## Use it from code

Every **Do it from code** block in the Email pages uses this client. Install `@norbix.ai/ts` (see [SDK install](/codemash/sdks/install.md)):

```ts
import { Norbix } from '@norbix.ai/ts';

const projectId = 'pr_40RAGBzUOOnUKKei8uK9ZP';
const norbix = new Norbix({ projectId }); // credentials from the environment

await norbix.hub.notifications.enableEmail();
```

The CLI lines use the generic `norbix hub notifications email …` commands of `@norbix.ai/cli`, signed in, with the project id in `NORBIX_PROJECT_ID`:

```sh
norbix hub notifications email enable
```

{% hint style="info" %}
How the examples were run: against a private test stack, with `@norbix.ai/ts` 4.13.0 and `@norbix.ai/cli` 1.16.0, signed in as the Cloud account owner (the SDK read the token from `NORBIX_BEARER_TOKEN`; the CLI used a saved session). The client sends the project id with every call (the `norbix-project-id` header), so the requests do not repeat it. These are Hub calls: they manage the module and need the matching `email:*` permission.
{% endhint %}

## Related

[Campaigns concept](/codemash/cloud/concepts/campaigns.md) · [Message templates](/codemash/cloud/concepts/message-templates.md) · [Tokens binding](/codemash/cloud/concepts/tokens-binding.md) · [Integrations concept](/codemash/cloud/concepts/integrations.md) · [Notification preview link](/codemash/cloud/concepts/message-templates/preview-link.md) · [SDK](/codemash/sdks/notifications/email.md) · [CLI](/codemash/cli/cli.md) · [API](/codemash/api-reference/notifications/email.md)
