Getting started with Yandex Cloud Postbox
Use this guide to create your address and send a verification email.
Getting started
Sign up for Yandex Cloud and create a billing account:
- Go to the management console
and log in to Yandex Cloud or create an account if you do not have one yet. - On the Yandex Cloud Billing
page, make sure you have a billing account linked and it has theACTIVE
orTRIAL_ACTIVE
status. If you do not have a billing account, create one.
If you have an active billing account, you can go to the cloud page
Learn more about clouds and folders.
Create a service account and keys
-
Create a service account named
postbox-user
and assign it thepostbox.sender
role. -
Create a key for the service account:
- To send an email using the AWS CLI, create a static access key. Save the ID and secret key to a secure location. You will not be able to view the secret key parameters again after you close the window.
- To send an email via SMTP, create an API key. When creating the API key, set the scope to
yc.postbox.send
. Save the secret key you get in a secure location. You will not be able to view the secret key parameters again after you close the window.
-
Generate a key to create a DKIM signature:
openssl genrsa -out privatekey.pem 2048
Create an address
-
In the management console
, select the folder where you created the service account. -
Select Cloud Postbox.
-
Click Create address.
-
Specify the Domain from which you will be sending emails. The domain can be of any level.
-
Specify Selector:
postbox
.Note
You can specify a selector other than
postbox
. You should only use the specified selector in a single resource record: the one you create at the Pass domain ownership verification step. -
Copy the contents of the
privatekey.pem
file you created earlier and paste it into the Private key field. -
Optionally, configure logging.
-
Click Create address.
Pass domain ownership verification
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 record you need to add to your domain zone. You can add a record with your registrar or in Yandex Cloud DNS if you have delegated your domain.
Example of creating a resource record in Cloud DNS
-
In the management console
, select the folder containing the address and your domain zone. -
Select Cloud DNS.
-
Select your domain zone.
-
Click Create record.
-
In the Name field, specify the name portion generated when creating the address, omitting the domain in
<selector>._domainkey.
format. For example,postbox._domainkey.
.Note
For other DNS services, you may need to copy the entire record. The final record must look like this:
<selector>._domainkey.<domain>.
, e.g.,postbox._domainkey.example.com.
. -
In the Type list, select
TXT
. -
Copy the contents of the Value field from the Signature verification section and paste it into the Data field. Note that the record value must be enclosed in quotes, for example:
"v=DKIM1;h=sha256;k=rsa;p=M1B...aCA8"
-
Click Create.
-
Go to Cloud Postbox.
-
Select the address you created.
-
Click Verify address. If the record is correct, the verification status on the address page will change to
Success
.
DNS server responses are cached, so delays may occur when updating a resource record.
Send a verification email
You can send a test email using the AWS CLI or from your email client over SMTP.
AWS CLI
-
Install
the AWS CLI. -
Set up the AWS CLI:
- Launch the interactive profile setup:
aws configure
- Specify the previously obtained key ID of the
postbox-user
service account:AWS Access Key ID [****************ver_]: <service_account_key_ID>
- Specify the previously obtained secret key of the
postbox-user
service account:AWS Secret Access Key [****************w5lb]: <service_account_secret_key>
- Specify the ru-central1 default region name:
Default region name [ru-central1]: ru-central1
- Specify
JSON
as the default format for output data:Default output format [None]: json
- Launch the interactive profile setup:
-
Prepare two JSON files:
-
destination.json
: File with a list of destination addresses:{ "ToAddresses": ["test@example.com"] }
-
message.json
: File with the subject and content of the email:{ "Simple": { "Subject": { "Data": "Test message", "Charset": "UTF-8" }, "Body": { "Text": { "Data": "Test message. Hello!", "Charset": "UTF-8" } } } }
-
-
Send an email using the AWS CLI:
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
-
Check the mailbox specified in
destination.json
for the email.
SMTP
-
In the SMTP server settings of your email client, specify the following parameters:
- Server name:
postbox.cloud.yandex.net
. - Port:
587
. - Username:
API_KEY
. - Password: Secret part of the created API key.
Note
Your email client must support the STARTTLS extension
to encrypt emails you send. - Server name:
-
Send an email using your email client and make sure the specified recipients receive it.