[Yandex Cloud documentation](../index.md) > [Yandex Cloud Postbox](index.md) > Getting started

# Getting started with Yandex Cloud Postbox

Use this guide to create your address and send a verification email.

## Getting started {#before-you-begin}

Sign up for Yandex Cloud and create a [billing account](../billing/concepts/billing-account.md):
1. Navigate to the [management console](https://console.yandex.cloud) and log in to Yandex Cloud or create a new account.
1. On the **[Yandex Cloud Billing](https://center.yandex.cloud/billing/accounts)** page, make sure you have a billing account linked and it has the `ACTIVE` or `TRIAL_ACTIVE` [status](../billing/concepts/billing-account-statuses.md). If you do not have a billing account, [create one](../billing/quickstart/index.md) and [link](../billing/operations/pin-cloud.md) a cloud to it.

If you have an active billing account, you can create or select a [folder](../resource-manager/concepts/resources-hierarchy.md#folder) for your infrastructure on the [cloud page](https://console.yandex.cloud/cloud).

[Learn more about clouds and folders here](../resource-manager/concepts/resources-hierarchy.md).

## Create a service account and keys {#service-account-and-keys}

1. [Create](../iam/operations/sa/create.md) a service account named `postbox-user` and [assign](../iam/operations/sa/assign-role-for-sa.md) the `postbox.sender` [role](security/index.md#postbox-sender) to it.
1. Create a key for the service account:
   * To send an email using the AWS CLI, [create](../iam/operations/authentication/manage-access-keys.md#create-access-key) a static access key. Save the ID and secret key to a secure location. You will not be able to view the secret key properties again after you close the window.
   * To send an email via SMTP, [create](../iam/operations/authentication/manage-api-keys.md#create-api-key) an API key. When creating an API key, set the scope to `yc.postbox.send`. Save the secret key you got in a secure location. You will not be able to view the secret key properties again after you close the window.

## Create an address {#create-address}

{% list tabs group=instructions %}

- Management console {#console}

    1. In the [management console](https://console.yandex.cloud), select the folder where you created the service account. If you create the service account and address in different folders, you will get an error when attempting to send an email.
    1. Navigate to **Cloud Postbox**.
    1. Click **Create address**.
    1. Specify the **Domain** from which you will be sending emails. You can use a domain of any level.
    1. Under **Email signature configuration (DKIM)**, select **Simple**.
    1. Optionally, [configure logging](operations/logs-write.md).
    1. Click **Create address**.

{% endlist %}

## Verify your domain ownership {#verify-domain}

To send emails, confirm domain ownership. After creating an address, DKIM signature settings will be generated on its page. Specify them as the values of the resource records you need to add to your domain zone. You can add the records via your registrar or in [Yandex Cloud DNS](../dns/index.md), if you have delegated your Yandex Cloud domain.

**Example of creating resource records in Yandex Cloud DNS**

{% list tabs group=instructions %}

- Management console {#console}

    1. In the [management console](https://console.yandex.cloud), select the folder containing the address and your domain zone.
    
       If you do not have a [public DNS zone](../dns/concepts/dns-zone.md#public-zones) yet, [create](../dns/operations/zone-create-public.md) one:
    1. Navigate to **Cloud Postbox**.
    1. Select the new address and open the **Email signature configuration (DKIM)** section.
    1. For each of the two CNAME records, complete the following steps:
    
        1. Navigate to **Cloud DNS**.
        1. Select your domain zone.
        1. Click **Create record**.
        1. In the **Type** field, select `CNAME`.
        1. Enter the record name from the **Email signature configuration (DKIM)** section on the address page into the **Name** field, omitting the domain.
    
           {% note info %}
    
           Other DNS services may require a full record name, including the domain.
    
           {% endnote %}
    
        1. In the **Data** field, paste the record value from the **Email signature configuration (DKIM)** section on the address page.
        1. In the **TTL (in seconds)** field, specify the record lifetime.
        1. Click **Create**.
    1. Navigate to **Cloud Postbox**.
    1. Select the address you created.
    1. Wait for Yandex Cloud Postbox to verify the DKIM signature settings. If the records are correct, the verification status on the address page will change to `Success`.

    DNS server responses are cached, so you may experience delays when updating resource records. If the verification status does not change within 24 hours, click **Run verification**.

{% endlist %}

## Send a verification email {#send-test-email}

You can send a test email using the [AWS CLI](#aws-cli-send) or from your email client over [SMTP](#smtp-send).

{% note info %}

To ensure the security of data transfer, Yandex Cloud Postbox supports TLS protocol versions 1.2 and 1.3.

{% endnote %}

### AWS CLI {#aws-cli-send}

1. [Install](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) the AWS CLI.
1. Set up the AWS CLI:
    1. Launch the interactive profile setup:
        ```
        aws configure
        ```
    1. Specify the previously obtained key ID of the `postbox-user` service account:
        ```
        AWS Access Key ID [****************ver_]: <service_account_key_ID>
        ```
    1. Specify the previously obtained secret key of the `postbox-user` service account:
        ```
        AWS Secret Access Key [****************w5lb]: <service_account_secret_key>
        ```
    1. Specify the ru-central1 default region name:
        ```
        Default region name [ru-central1]: ru-central1
        ```
    1. Specify `JSON` as the default format for output data:
        ```
        Default output format [None]: json
        ```

1. Prepare two JSON files:

    * `destination.json`: File with a list of destination addresses:

        ```json
        {
          "ToAddresses": ["test@example.com"]
        }
        ```

    * `message.json`: File with the subject and content of the email:

       ```json
       {
         "Simple": {
           "Subject": {
             "Data": "Test message",
             "Charset": "UTF-8"
           },
           "Body": {
             "Text": {
               "Data": "Test message. Hello!",
               "Charset": "UTF-8"
             }
           }
         }
       }
       ```

1. Send an email using the AWS CLI:

    ```bash
    aws sesv2 send-email \
      --from-email-address mail@example.com \
      --destination file://destination.json \
      --content file://message.json \
      --endpoint-url https://postbox.cloud.yandex.net
    ```

1. Check the mailbox specified in `destination.json` for the email.

### SMTP {#smtp-send}

1. In the SMTP server settings of your email client, specify the following parameters:

    #|
    || | **Email client supports STARTTLS** | **Email client supports SMTPS instead of STARTTLS** ||
    || **Server name** | `postbox.cloud.yandex.net` {align="center"} | > ||
    || **Port** | `587` | `465` ||
    || **Username** | ID of the created API key {align="center"} | > ||
    || **Password** | Secret part of the created API key {align="center"} | > ||
    |#

1. Send an email using your email client and make sure the specified recipients receive it.

#### Useful links {#see-also}

* [Email event notifications](concepts/notification.md)
* [Sending an email](operations/send-email.md)