# Sending email

Imagine you run a clothing store online shop. When a customer finishes an order, you want to automatically send a confirmation email that says "Your order has been received." But before you can send mail, you first have to decide "which address it goes out from, and under what name." For it to arrive in the customer's inbox stamped with the name `Clothing store support` and your store's address, you register that sender information in one place ahead of time. Registering the sender you will send mail from is what an *Email Account* is.

You can compare it to the sender information pre-printed on a company's letterhead. Instead of writing the sender's address and name anew for every letter, you take out the pre-printed stationery, and it always goes out from the same sender. An *Email Account* works like that stationery: register it once, and every email that goes out afterward goes out from the same sender.

There is one thing worth clarifying. An *Email Account* **only registers** the sender. Actually writing an email and sending it to a customer is done by a *Script*'s `EmailSend`, which points at this *Email Account* (covered below in [Sending mail with the registered sender](#sending-mail-with-the-sender)). On this page you will first look at what you register in an *Email Account*, and then register a sender directly in the clothing store *Space*.

## What you register {#what-you-register}

In an *Email Account* you register three groups of values: the server that sends the mail, the login information for that server, and the sender shown to customers.

- **Sending server**: The address and port of the sending server (an SMTP server, a server that transmits mail in the standard way) that actually sends the mail out. The security method that protects the connection is decided automatically by this port. Port `587` is paired with `StartTls` and port `465` with `Tls`, so you do not choose a security method separately.
- **Login information**: The username and password used to log in to that sending server. The username differs by sending server. It may be the email address itself, or a fixed string set by the sending service.
- **Sender**: The from address shown to customers (the sending address) and the name shown in the customer's inbox (the sender display name). For example, the sending address might be `dailycloset.orders@gmail.com` and the sender display name `Clothing store support`. If you leave the sender display name empty, only the address is shown.

Only the sender is visible to customers; the sending server and login information are used only behind the scenes to actually send the mail out.

## Registering actually sends a test email {#a-test-message-is-actually-sent}

Registering an *Email Account* is not an action that merely saves the values you entered. Before saving, it actually connects with the sending server and login information you entered and **sends one test email.** The sender is saved only if this send succeeds.

- If the send succeeds, the *Email Account* is registered.
- If it fails at any step, whether connecting, logging in, or sending, it fails with **nothing registered**, and the failure reason returned by the sending server is shown alongside.

So you should know that a real email goes out the moment you press the register button. If you enter wrong values and try to register several times, a real send is attempted each time.

## Connection settings cannot be changed later {#connection-settings-are-fixed}

Some of the registered values can be changed later, and some cannot.

- **The sending server and login information cannot be changed after registration.** To move to a different sending server or change the login password, you do not edit them; instead you **register a new *Email Account* and delete the old one.**
- **The sender and the name can be changed even after registration.** The sending address and sender display name shown to customers, and the name that distinguishes multiple senders in the content studio, can all be edited later.

The password cannot be seen again after registration. You enter it once at registration, and it is never shown anywhere afterward, so if you forget the password you change it by registering again, not by resetting it.

## Which sending servers you can use {#which-servers-you-can-use}

Which sending servers you can use depends on your plan.

- **The built-in sending services** (Gmail, Naver, Resend, Brevo) can be registered on every plan. Just choose one from the list and the address, port, and security method are filled in automatically.
- **Your own sending server that is not in the list** can be used only on a paid plan with a registered payment method. Trying to register a server that is not in the list on a free plan is rejected.

For per-plan policies, see [Pricing](/pricing/pricing.md).

To use Naver Mail, you first have to turn on POP3/SMTP on the Naver side and get an application password. That process is covered in [Getting Naver Mail ready to send](/getting-started/core-concepts/deployment-and-integration/email/naver.md).

You can use Resend only after registering a domain you own and having it verified. That process is covered in [Getting Resend ready to send](/getting-started/core-concepts/deployment-and-integration/email/resend.md).

Brevo requires you to have the sending address verified first and then create a separate SMTP key. That process is covered in [Getting Brevo ready to send](/getting-started/core-concepts/deployment-and-integration/email/brevo.md).

## Registering in the content studio {#registering-in-the-content-studio}

Now register a sender in the clothing store *Space* for sending order notification emails. Use the built-in Gmail as the sending server, and set the sender to `Clothing store support`.

Before you start, get a Gmail app password ready. A field for entering this value comes up during registration. How to get one is covered in [Getting Gmail ready to send](/getting-started/core-concepts/deployment-and-integration/email/gmail.md).

![The Email list screen. It is empty with no Email Account registered yet, and the Create button is visible at the top right](/_img/en-US/getting-started/core-concepts/deployment-and-integration/images/email-01-list-empty.webp)

1. From **Settings & Management** in the left menu, open **Email**.
2. Press the **Create** button at the top right.
3. In Provider, choose **Gmail**. The **SMTP server** and **Port** are filled in automatically, and the security method is decided by the port you chose (STARTTLS for 587). To use a server that is not in the list, choose **Custom SMTP** and enter the server address and port yourself.
4. In the **Gmail address** field, enter the Gmail account you will log in with (for example, `dailycloset.orders@gmail.com`).
5. In the **App password** field, enter the 16-character app password you got in advance. It is not your Google account password. This value cannot be seen again after saving. If you have not got one yet, get one by following [Getting Gmail ready to send](/getting-started/core-concepts/deployment-and-integration/email/gmail.md).
6. In the **Name** field, enter a name to distinguish this sender, `Order notice sender`. This name is shown only in the content studio, so it has nothing to do with actual mail sending.
7. In the **From address** field, enter the sending address customers will see (for example, `dailycloset.orders@gmail.com`). When using Gmail, even if you enter an address different from the authenticated account, the actual send goes out overwritten with the authenticated account's address.
8. In the **From display name** field, enter the name that will show in the customer's inbox, `Clothing store support`. If you leave it empty, only the address is shown.
9. Press the **Save** button.

![The Email Account create screen. Gmail is chosen as the Provider so the SMTP server and port are filled in automatically, and the Gmail address, app password, name, from address, and sender display name are filled in](/_img/en-US/getting-started/core-concepts/deployment-and-integration/images/email-02-create.webp)

When you press the **Save** button, one test email is sent with the information you entered. If the send succeeds, `Order notice sender` appears in the list. If it fails, the reason returned by the sending server is shown and nothing is registered, so check the login information or sending server values again.

![The Email list screen. The "Order notice sender" Email Account is registered as one row, showing the Provider, SMTP endpoint, and sender information](/_img/en-US/getting-started/core-concepts/deployment-and-integration/images/email-03-list.webp)

## Sending mail with the registered sender {#sending-mail-with-the-sender}

An *Email Account* only registers the sender; it does not send mail by itself. The actual sending is handled by a *Script*'s `EmailSend`. `EmailSend` is an action that spells out "send an email from this sender, to this address, with this subject and body," and which sender to send from is set by pointing at the *Email Account* you just registered. The sending address and sender display name are carried over directly from the *Email Account* you pointed at, so in `EmailSend` you set only the recipient, subject, and body.

For the clothing store's order notification email, the flow is as follows.

1. When a customer places an order, the order is registered as a *Content*.
2. A *Webhook* notices the order being registered and runs a *Script* you prepared in advance.
3. The *Script*'s `EmailSend` points at the `Order notice sender` *Email Account* and sends the order confirmation email to that customer.

One `EmailSend` sends to a single recipient. If there are several orders, it loops within the *Script* to send one per order. A detailed example of registering a sender like this and connecting it with a *Script* is covered in the documents below.

## What to do next {#what-to-do-next}

- [Script](/getting-started/core-concepts/deployment-and-integration/script.md): Covers how to build a task that runs inside a *Space*, containing the `EmailSend` that actually sends mail with the *Email Account* you registered.
- [Webhook](/getting-started/core-concepts/deployment-and-integration/webhook.md): Covers how to connect things so that the *Script* that sends mail runs automatically the moment an order is registered.
- [Email Account](/api/reference/cma/email-account.md): Covers the request and response formats and field specifications used to register and manage an *Email Account* directly from a program.
