Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Cloud Functions
  • Comparing with other Yandex Cloud services
    • Overview
    • Function
    • Invoking a function
    • Asynchronous function invocation
    • Long-lived functions
    • Function termination notifications
    • Networking
    • Mounting external resources to a function file system
    • Builder
      • Overview
      • Timer
      • Trigger for Message Queue
      • Trigger for Object Storage
      • Trigger for Container Registry
      • Trigger for Cloud Logging
      • Trigger for Yandex IoT Core
      • Trigger for budgets
      • Trigger for Data Streams
      • Email trigger
    • Dead Letter Queue
    • Function logs
    • Backups
    • Quotas and limits
  • Tools
  • Pricing policy
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes
  • FAQ

In this article:

  • Message batching
  • Roles required for the proper operation of an email trigger
  • Email trigger message format
  • Useful links
  1. Concepts
  2. Trigger
  3. Email trigger

Email trigger that invokes a Cloud Functions function

Written by
Yandex Cloud
Updated at July 8, 2026
View in Markdown
  • Message batching
  • Roles required for the proper operation of an email trigger
  • Email trigger message format
  • Useful links

An email trigger launches a Cloud Functions function when an email arrives. Cloud Functions will automatically generate an email address when creating the trigger.

An email trigger requires a service account to call its function.

For more information about creating an email trigger, see Creating an email trigger that invokes Cloud Functions.

Message batchingMessage batching

Batching settings allow you to send multiple messages to a function at the same time. They set a top limit on the message batch size and accumulation time. For example, if the message batch size is 3, the function can receive batches of one to three messages.

Roles required for the proper operation of an email triggerRoles required for the proper operation of an email trigger

  • To create a trigger, you need a permission for the service account under which the trigger runs the operation. This permission comes with the iam.serviceAccounts.user and editor roles or higher.
  • For the trigger to fire, the service account requires the functions.functionInvoker role for the function invoked by the trigger.
  • To save attachments to an Object Storage bucket, a service account needs the storage.uploader role.

Email trigger message formatEmail trigger message format

After the trigger is activated, it sends the following message to the function:

{
   "messages":[
      {
         "received_at":"2022-09-15 14:42:23.983842092 +0000 UTC m=+260285.403254765",
         "headers":[
            {
               "name":"X-Yandex-Fwd",
               "values":[
                  "1"
               ]
            },
            {
               "name":"Authentication-Results",
               "values":[
                  "myt6-22bd3499f8ff.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru"
               ]
            },
            {
               "name":"Dkim-Signature",
               "values":[
                  "v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1663252943; bh=5mogyQPnK9aR1QY58xdFic7MyJaCt1srWO58********; h=Message-Id:Date:Subject:To:From; b=en6OA2ufXC06U3rYWymIMaETTbm2yR0ryNhNY7h0nzyiCCftzlvxOWaoA4ObXhiAE mTdrT8R1kVaHFTa3ljkD6m5fx********/83Es5mZw4s8Q3Rn********//L8y414e 1T6rD********/2JEq45AaiqlS4Pw6NCp********"
               ]
            },
            {
               "name":"From",
               "values":[
                  "John Doe <somebody@yandex.ru>"
               ]
            },
            {
               "name":"Content-Transfer-Encoding",
               "values":[
                  "7bit"
               ]
            },
            {
               "name":"Date",
               "values":[
                  "Thu, 15 Sep 2022 17:42:23 +0300"
               ]
            },
            {
               "name":"X-Mailer",
               "values":[
                  "Yamail [ http://yandex.ru ] 5.0"
               ]
            },
            {
               "name":"To",
               "values":[
                  "'a1serq2n5f3u********-mtff****@serverless.yandexcloud.net' <a1serq2n5f3u********-mtff****@serverless.yandexcloud.net>"
               ]
            },
            {
               "name":"Subject",
               "values":[
                  "Example email topic for documentation"
               ]
            },
            {
               "name":"Message-Id",
               "values":[
                  "<5519545********@mail.yandex.ru>"
               ]
            },
            {
               "name":"Content-Type",
               "values":[
                  "text/html"
               ]
            },
            {
               "name":"Received",
               "values":[
                  "from forward501j.mail.yandex.net (forward501j.mail.yandex.net. [5.45.198.251]) by serverless.yandexcloud.net (YandexCloudFunctions) with SMTP for <a1serq2n5fk9********-mtff****@serverless.yandexcloud.net>; Thu, 15 Sep 2022 14:42:23 +0000 (UTC)",
                  "from myt6-22bd3499f8ff.qloud-c.yandex.net (myt6-22bd3499f8ff.qloud-c.yandex.net [IPv6:2a02:6b8:c12:239b:0:640:22bd:3499]) by forward501j.mail.yandex.net (Yandex) with ESMTP id C57******** for <a1serq2n5fk9********-mtff****@serverless.yandexcloud.net>; Thu, 15 Sep 2022 17:42:23 +0300 (MSK)",
                  "from 2a02:6b8:c12:1584:0:640:71d5:0 (2a02:6b8:c12:1584:0:640:71d5:0 [2a02:6b8:c12:1584:0:640:71d5:0]) by myt6-22bd3499f8ff.qloud-c.yandex.net (mxback/Yandex) with HTTP id KgdCMT3fZCg1-********; Thu, 15 Sep 2022 17:42:23 +0300",
                  "by 7f4cvd2xm7d2gxse.myt.yp-c.yandex.net with HTTP; Thu, 15 Sep 2022 17:42:23 +0300"
               ]
            },
            {
               "name":"Mime-Version",
               "values":[
                  "1.0"
               ]
            }
         ],
         "attachments":{
            "bucket_id":"trigger-bucket-id",
            "keys":[
               "attachement-object-key1",
               "attachement-object-key2"
            ]
         },
         "message":"<div>This is example body for documentation</div>\r\n"
      }
   ]
}

Useful linksUseful links

  • Email trigger that invokes a Serverless Containers container
  • Email trigger that sends messages to WebSocket connections

Was the article helpful?

Previous
Trigger for Data Streams
Next
Dead Letter Queue
© 2026 Direct Cursus Technology L.L.C.