|
| 1 | +--- |
| 2 | +title: How to send email with Cloudflare Email |
| 3 | +description: How to send transactional email notifications with Cloudflare Email Service and Knock. |
| 4 | +tags: ["cloudflare", "email", "email service", "transactional"] |
| 5 | +section: Integrations > Email |
| 6 | +layout: integrations |
| 7 | +--- |
| 8 | + |
| 9 | +Knock supports using <a href="https://developers.cloudflare.com/email-service/get-started/send-emails/" target="_blank" rel="noopener noreferrer">Cloudflare Email Service</a> to send email notifications to your users. |
| 10 | + |
| 11 | +<Callout |
| 12 | + type="info" |
| 13 | + title="Cloudflare DNS required" |
| 14 | + text={ |
| 15 | + <> |
| 16 | + Cloudflare Email Service requires your domain's DNS to be configured |
| 17 | + correctly on Cloudflare. See{" "} |
| 18 | + <a |
| 19 | + href="https://developers.cloudflare.com/email-service/configuration/domains/" |
| 20 | + target="_blank" |
| 21 | + rel="noopener noreferrer" |
| 22 | + > |
| 23 | + Email Service domain configuration |
| 24 | + </a>{" "} |
| 25 | + for DNS record details. |
| 26 | + </> |
| 27 | + } |
| 28 | +/> |
| 29 | + |
| 30 | +## Features |
| 31 | + |
| 32 | +- Knock link and open tracking |
| 33 | +- Per environment configuration |
| 34 | +- Sandbox mode |
| 35 | + |
| 36 | +## Getting started |
| 37 | + |
| 38 | +1. In the Cloudflare dashboard, create an **API token** (or use a compatible **API key**) with permission to send email for your account, and copy your Cloudflare **account ID**. See Cloudflare's <a href="https://developers.cloudflare.com/fundamentals/api/get-started/create-token/" target="_blank" rel="noopener noreferrer">API token documentation</a> and <a href="https://developers.cloudflare.com/fundamentals/account/find-account-and-zone-ids/" target="_blank" rel="noopener noreferrer">how to find your account ID</a>. |
| 39 | +2. In Knock, open **Channels and sources** in your account settings and create a **Cloudflare Email** channel. |
| 40 | +3. For each [environment](/concepts/environments), open **Manage configuration** on the channel and enter your **Account ID** and **API key** (your Cloudflare API token or key), plus your default **From** address and optional **From** name. Use addresses on domains you have verified for sending in Cloudflare. |
| 41 | + |
| 42 | +## Channel configuration |
| 43 | + |
| 44 | +The following channel settings should be configured per [environment](/concepts/environments). Navigate to **Channels and sources** in your dashboard account settings, select your Cloudflare Email [channel](/concepts/channels), then click "Manage configuration" under the environment that you'd like to configure. |
| 45 | + |
| 46 | +<AccordionGroup> |
| 47 | + <Accordion title="Settings"> |
| 48 | + Fields marked with an `*` are required. |
| 49 | + |
| 50 | + **Knock settings** |
| 51 | + <Attributes> |
| 52 | + <Attribute |
| 53 | + name="Sandbox mode" |
| 54 | + type="boolean" |
| 55 | + nameSlug="/integrations/overview#sandbox-mode" |
| 56 | + description="Whether to enable sandbox mode for your Cloudflare Email channel." |
| 57 | + /> |
| 58 | + <Attribute |
| 59 | + name="Knock open tracking" |
| 60 | + nameSlug="/send-notifications/tracking#email-open-tracking" |
| 61 | + type="boolean" |
| 62 | + description="Whether to enable Knock email-open tracking." |
| 63 | + /> |
| 64 | + <Attribute |
| 65 | + name="Knock link tracking" |
| 66 | + nameSlug="/send-notifications/tracking#link-click-tracking" |
| 67 | + type="boolean" |
| 68 | + description="Whether to enable Knock link-click tracking." |
| 69 | + /> |
| 70 | + </Attributes> |
| 71 | + |
| 72 | + **Provider settings for Cloudflare Email** |
| 73 | + <Attributes> |
| 74 | + <Attribute |
| 75 | + name="Account ID" |
| 76 | + type="string*" |
| 77 | + description="Your Cloudflare account ID. Used with Cloudflare's email sending API." |
| 78 | + /> |
| 79 | + <Attribute |
| 80 | + name="API key" |
| 81 | + type="string*" |
| 82 | + description="Your Cloudflare API token or API key with permission to send email for this account." |
| 83 | + /> |
| 84 | + <Attribute |
| 85 | + name="From email address" |
| 86 | + type="string | liquid*" |
| 87 | + description="The default sender email address (can use Liquid tags). Must use a domain you have configured for sending in Cloudflare." |
| 88 | + /> |
| 89 | + <Attribute |
| 90 | + name="From name" |
| 91 | + type="string | liquid" |
| 92 | + description="The default sender name (can use Liquid tags)." |
| 93 | + /> |
| 94 | + </Attributes> |
| 95 | + |
| 96 | + </Accordion> |
| 97 | + <Accordion title="Overrides"> |
| 98 | + When configured, these optional overrides will apply to all emails sent from this channel in the configured environment. See [Settings and overrides](/integrations/email/settings) for more on email channel overrides. |
| 99 | + |
| 100 | + <Attributes> |
| 101 | + <Attribute |
| 102 | + name="To" |
| 103 | + type="string | liquid" |
| 104 | + description="The To email address that email notifications will be sent to (can use Liquid tags). This value will override the designated recipient's email address." |
| 105 | + /> |
| 106 | + <Attribute |
| 107 | + name="Cc" |
| 108 | + type="string | liquid" |
| 109 | + description="The CC email address that email notifications will be sent to (can use Liquid tags)." |
| 110 | + /> |
| 111 | + <Attribute |
| 112 | + name="Bcc" |
| 113 | + type="string | liquid" |
| 114 | + description="The BCC email address that email notifications will be sent to (can use Liquid tags)." |
| 115 | + /> |
| 116 | + <Attribute |
| 117 | + name="Reply-to" |
| 118 | + type="string | liquid" |
| 119 | + description="The reply-to email address that will be included on email notifications (can use Liquid tags)." |
| 120 | + /> |
| 121 | + <Attribute |
| 122 | + name="Payload overrides" |
| 123 | + nameSlug="/integrations/email/settings#provider-json-overrides" |
| 124 | + type="JSON (string) | liquid" |
| 125 | + description="Provide a JSON object to merge into the API payload that is sent to the downstream provider." |
| 126 | + /> |
| 127 | + </Attributes> |
| 128 | + |
| 129 | + </Accordion> |
| 130 | + <Accordion title="Conditions"> |
| 131 | + Set optional per-environment [conditions](/integrations/overview#channel-conditions) for this channel. These conditions are evaluated each time a workflow run encounters a step that uses this channel in the configured environment. If the conditions are not met, the step will be skipped. |
| 132 | + </Accordion> |
| 133 | +</AccordionGroup> |
| 134 | + |
| 135 | +## Recipient data requirements |
| 136 | + |
| 137 | +To send an email notification you'll need a valid `email` property set on your recipient. |
0 commit comments