---
title: "Email Marketing"
description: "Campaigns. Keep mailing lists with each contact's consent status and date, and prepare campaigns."
canonical: "https://obop.dev/apps/email-marketing/"
lang: "en"
---

# Email Marketing

## What it is for

Keep mailing lists with each contact's consent status and date, and prepare campaigns. Sending reaches real people and cannot be undone, so it always needs a human approval.

## What the package does and does not do

Mailing lists, the contacts on them with their consent status and date, and campaigns with a draft, scheduled, sent flow. Sending is irreversible and reaches real people, so it needs a human approval from a manager; agents may only propose it. Campaign statistics are numbers entered or imported, not computed. Contacts are personal data: keep consent_status and consent_date accurate and never mail a contact that is not opted_in.

## Models

### `email_marketing_list`

A mailing list contacts can belong to

Read group: `email_marketing.user`. Write group: `email_marketing.manager`.

| Field | Kind | Data class | Personal data | Group | Agents see | Description |
|---|---|---|---|---|---|---|
| `name` | text | `none` | no | `email_marketing.user` | in clear | List name, for example Newsletter |
| `description` | longtext | `none` | no | `email_marketing.user` | in clear | What subscribers receive |
| `is_public` | bool | `none` | no | `email_marketing.user` | in clear | Whether visitors can subscribe themselves |

### `email_marketing_contact`

A person on a mailing list

Read group: `email_marketing.user`. Write group: `email_marketing.user`.

| Field | Kind | Data class | Personal data | Group | Agents see | Description |
|---|---|---|---|---|---|---|
| `list_id` | ref → email_marketing_list | `none` | no | `email_marketing.user` | in clear | The list the contact is on |
| `email` | text | `internal` | yes | `email_marketing.user` | masked | Email address |
| `name` | text | `internal` | yes | `email_marketing.user` | masked | Name of the contact |
| `consent_status` | select (pending, opted_in, opted_out, bounced) | `internal` | yes | `email_marketing.user` | masked | Permission to mail: pending, opted_in, opted_out, bounced |
| `consent_date` | date | `internal` | yes | `email_marketing.user` | masked | Day the contact gave or withdrew permission (YYYY-MM-DD) |
| `consent_source` | text | `internal` | yes | `email_marketing.user` | masked | Where consent was collected, for example website signup form |

### `email_marketing_campaign`

One mailing sent to a list

Read group: `email_marketing.user`. Write group: `email_marketing.user`.

| Field | Kind | Data class | Personal data | Group | Agents see | Description |
|---|---|---|---|---|---|---|
| `name` | text | `none` | no | `email_marketing.user` | in clear | Internal campaign name |
| `subject` | text | `none` | no | `email_marketing.user` | in clear | Email subject line |
| `preview_text` | text | `none` | no | `email_marketing.user` | in clear | Short text shown after the subject in inboxes |
| `from_name` | text | `none` | no | `email_marketing.user` | in clear | Sender name shown to recipients |
| `from_email` | text | `none` | no | `email_marketing.user` | in clear | Sender address shown to recipients |
| `list_id` | ref → email_marketing_list | `none` | no | `email_marketing.user` | in clear | The list the campaign goes to |
| `body` | longtext | `none` | no | `email_marketing.user` | in clear | Email content (HTML or Markdown, as the sender expects) |
| `scheduled_for` | date | `none` | no | `email_marketing.user` | in clear | Day the campaign is to be sent (YYYY-MM-DD) |
| `sent_on` | date | `none` | no | `email_marketing.user` | in clear | Day the campaign was sent (YYYY-MM-DD) |
| `sent_count` | number | `none` | no | `email_marketing.user` | in clear | Emails handed to the mail server |
| `delivered_count` | number | `none` | no | `email_marketing.user` | in clear | Emails accepted by recipients' servers |
| `opened_count` | number | `none` | no | `email_marketing.user` | in clear | Recipients who opened the email |
| `clicked_count` | number | `none` | no | `email_marketing.user` | in clear | Recipients who clicked a link |
| `bounced_count` | number | `none` | no | `email_marketing.user` | in clear | Emails that bounced |
| `unsubscribed_count` | number | `none` | no | `email_marketing.user` | in clear | Recipients who unsubscribed because of this campaign |
| `state` | select (draft, scheduled, sent, cancelled) | `none` | no | `email_marketing.user` | in clear | Campaign status: draft, scheduled, sent, cancelled |

## Workflows

### `email_marketing_campaign`

| Action | Moves | Who may run it | Approval |
|---|---|---|---|
| `email_marketing_campaign.schedule` | state: draft → scheduled | `email_marketing.user` | no |
| `email_marketing_campaign.send` | state: scheduled → sent | `email_marketing.manager` | yes |
| `email_marketing_campaign.send_now` | state: draft → sent | `email_marketing.manager` | yes |
| `email_marketing_campaign.unschedule` | state: scheduled → draft | `email_marketing.user` | no |
| `email_marketing_campaign.cancel` | state: scheduled → cancelled | `email_marketing.user` | no |

## Permission groups

Groups used by this app:

- `email_marketing.manager`
- `email_marketing.user`

## Approval steps

Steps an agent can only propose:

- `email_marketing_campaign.send`
- `email_marketing_campaign.send_now`

## What agents can and cannot do

An agent can read, search, create and update records of this app, and run the actions that need no approval, within the permission groups of its token.

It can only propose these steps, and a person must approve them: `email_marketing_campaign.send`, `email_marketing_campaign.send_now`, `email_marketing_list.delete`, `email_marketing_contact.delete`, `email_marketing_campaign.delete`.

Personal data is masked as placeholder tokens: `email_marketing_contact.email`, `email_marketing_contact.name`, `email_marketing_contact.consent_status`, `email_marketing_contact.consent_date`, `email_marketing_contact.consent_source`.

## Dependencies

None.

## Install

Install it from the Customize app (Marketplace), or from the command line:

```bash
obop modules install-from email_marketing
```

Needs a database and administrator rights.

## Build your own

[The module guide shows how apps like this one are written](/docs/reference/module-manifest/)
