> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alumio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Send email

> Sends an email.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Sends an email as a step in your route. Use this to notify someone when data passes through, for example emailing a confirmation when an order is processed, alerting a team when a record needs attention, or forwarding a summary to a mailbox. You set who the message is from and to, the subject, and the body, and you can build any of these from the data using placeholders. The message is sent through an email connection you choose, which holds the mail server details. The data flowing through the route is not changed; this step only sends the email.

This documentation describes: [Schema](/schemas/transformer/email-transformer)

## Fields

<FormField property="transport" label="Email connection" required diType="email-server">
  The pre-configured connection that delivers the message, holding the mail server address and credentials. You select an existing email connection or configure one here.
</FormField>

<FormField property="sender.email" label="Sender email address" required>
  The address the email is sent from, for example `noreply@yourcompany.com`. Placeholders are supported, so it can come from the data.
</FormField>

<FormField property="sender.name" label="Sender name">
  The display name shown next to the sender address, for example `Your Company`. Leave it empty to show only the address. Placeholders are supported.
</FormField>

<FormField property="recipients.to" label="To" required>
  Who the email is sent to. Enter one address, or several separated by commas. Placeholders are supported, so you can pull a recipient from the data, for example `&{customer.email}`.
</FormField>

<FormField property="recipients.cc" label="Cc">
  Addresses to copy in, separated by commas. Everyone can see these addresses. Placeholders are supported.
</FormField>

<FormField property="recipients.bcc" label="Bcc">
  Addresses to copy in privately, separated by commas. The people in To and Cc cannot see these recipients. Placeholders are supported.
</FormField>

<FormField property="subject" label="Subject" required>
  The subject line of the email. Placeholders are supported, for example `Order &{order.id} confirmed`.
</FormField>

<FormField property="bodyFormat" label="Email message" required>
  Chooses how the body is written and which body fields appear below: **HTML** (the default) for a formatted message, **Plain text** for an unformatted one, or **Both** to send both versions so each recipient's email program can display the one it prefers.
</FormField>

<FormField property="bodyHtml" label="HTML">
  The HTML version of the message body. Shown when the message format is HTML or Both, and required in those cases. Placeholders are supported, so you can personalise the message with data from the route, for example `Hi &{customer.name}, your order has shipped.`
</FormField>

<FormField property="bodyText" label="Plain text">
  The plain-text version of the message body. Shown when the message format is Plain text or Both, and required in those cases. Placeholders are supported.
</FormField>

<FormField property="logging" label="Enable logging for">
  Choose which parts of each sent email are recorded in the logs: the subject, the sender, the recipients, and the message body (long messages are shortened in the log). Pick only what you need; leave it empty to keep email details out of the logs.
</FormField>

## Sample data

This step sends an email rather than changing the data, so there is no before and after; the data passing through is left untouched. The example below sends an order confirmation, building the recipient, subject, and body from the order data with placeholders.

| Field                | Value                                                              |
| -------------------- | ------------------------------------------------------------------ |
| Email connection     | The configured email connection                                    |
| Sender email address | `noreply@yourcompany.com`                                          |
| Sender name          | `Your Company`                                                     |
| To                   | `&{customer.email}`                                                |
| Subject              | `Order &{order.id} confirmed`                                      |
| Email message        | HTML                                                               |
| HTML                 | `<p>Hi &{customer.name}, your order &{order.id} is confirmed.</p>` |

```json Configuration theme={null}
{
  "prototype": "email-transformer",
  "parameters": {
    "transport": "default",
    "sender": {
      "email": "noreply@yourcompany.com",
      "name": "Your Company"
    },
    "recipients": {
      "to": "&{customer.email}"
    },
    "subject": "Order &{order.id} confirmed",
    "bodyFormat": "html",
    "bodyHtml": "<p>Hi &{customer.name}, your order &{order.id} is confirmed.</p>"
  }
}
```

See [Placeholders](/references/placeholders) for how to reference values such as `&{customer.email}` when building the message.
