> For the complete documentation index, see [llms.txt](https://kasplo.gitbook.io/kasplo-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kasplo.gitbook.io/kasplo-doc/channels/email-api/amp-email.md).

# AMP Email

## AMP Email

Kasplo supports **AMP for Email** through both Email API and SMTP.

AMP for Email allows supported email clients to display interactive and dynamic content directly inside an email, such as forms, carousels, accordions, polls, and live content.

Recipients using email clients that do not support AMP will receive the standard HTML or plain-text version of the email.

### Supported sending methods

AMP emails can be sent through:

* Email API
* SMTP

The message must include an AMP version together with a standard fallback version.

### Send via Email API

When sending through the Kasplo Email API, provide the AMP content together with the normal HTML and plain-text content.

Example:

```
{
  "from": "sender@example.com",
  "to": "recipient@example.com",
  "subject": "AMP Email Example",
  "text": "Plain-text fallback content",
  "html": "<p>HTML fallback content</p>",
  "amp_html": "<!doctype html>...AMP content..."
}
```

Kasplo constructs the required MIME structure for delivery.

The API request itself continues to use the standard Kasplo API request format.

### Send via SMTP

When sending through SMTP, construct the message using:

```
multipart/alternative
```

The message should contain:

```
text/plain
text/x-amp-html
text/html
```

The AMP MIME part must use:

```
Content-Type: text/x-amp-html
```

Example:

```
Content-Type: multipart/alternative; boundary="XYZ"

--XYZ
Content-Type: text/plain; charset=UTF-8

Plain-text fallback content

--XYZ
Content-Type: text/x-amp-html; charset=UTF-8

<!doctype html>
<html ⚡4email>
...
</html>

--XYZ
Content-Type: text/html; charset=UTF-8

<p>HTML fallback content</p>

--XYZ--
```

The AMP part should be placed before the HTML fallback.

### AMP content requirements

A valid AMP email must include a `text/x-amp-html` MIME part containing valid AMP for Email markup.

The message should also include an HTML or plain-text fallback so that recipients can still view the email when AMP is unavailable.

A basic AMP email document looks like:

```
<!doctype html>
<html ⚡4email>
<head>
  <meta charset="utf-8">
  <style amp4email-boilerplate>
    body { visibility: hidden }
  </style>
  <script async src="https://cdn.ampproject.org/v0.js"></script>
</head>
<body>
  AMP email content
</body>
</html>
```

Only components and functionality supported by the AMP for Email specification can be used.

External JavaScript is not supported.

### Sender registration

Sending a valid AMP message does not automatically mean AMP content will be displayed to recipients.

Supported mailbox providers may require sender registration or approval before enabling dynamic email for production traffic.

Before requesting approval:

* Configure SPF and DKIM correctly.
* Configure DMARC.
* Ensure the sending identity is aligned with the authenticated domain.
* Maintain a good sender reputation.
* Prepare a production-ready AMP email.
* Include a valid HTML fallback.
* Validate and test the AMP version.

Registration and approval requirements are controlled by the receiving mailbox provider and may change independently of Kasplo.

#### Gmail

Google requires production AMP senders to register the sender email address used for dynamic email.

Before registration, send a production-ready AMP email from your production sending environment to:

```
ampforemail.whitelisting@gmail.com
```

Then complete Google's AMP sender registration process.

Google AMP for Email registration:

<https://developers.google.com/workspace/gmail/ampemail/register>

#### Yahoo Mail

Yahoo requires AMP senders to meet its sender and authentication requirements.

Send a production-ready AMP email to:

```
ampverification@yahoo.com
```

Follow Yahoo's AMP sender registration process before sending production AMP email to Yahoo recipients.

Yahoo AMP sender requirements:

<https://senders.yahooinc.com/amp/>

#### Mail.ru

For Mail.ru registration, send a production-ready AMP email to:

```
postmaster_amp@corp.mail.ru
```

Then complete the applicable sender approval process.

Mail.ru AMP documentation:

<https://help.mail.ru/developers/amp/enable/>

### Test before production

Before requesting sender approval or sending AMP email to customers:

1. Validate the AMP markup.
2. Verify the HTML fallback.
3. Test using the same sending setup that will be used in production.
4. Confirm SPF, DKIM, and DMARC authentication.
5. Verify that dynamic content and form endpoints work correctly.

For Gmail testing, individual sender addresses can be enabled through Gmail's **Dynamic email developer settings** before production registration is completed.

### Dynamic content and forms

AMP emails can retrieve data and submit actions to external endpoints using supported AMP components.

When using functionality such as `amp-list` or `amp-form`:

* Use HTTPS endpoints.
* Follow AMP for Email CORS requirements.
* Secure authenticated or personalized requests appropriately.
* Do not rely on standard browser cookie behaviour.

Dynamic endpoints should be designed specifically for the security requirements of AMP for Email.

### Fallback behaviour

The HTML or plain-text version may be displayed instead of AMP when:

* The recipient's email client does not support AMP.
* Dynamic email is disabled by the recipient.
* The sender has not completed the mailbox provider's required approval.
* The AMP content is invalid.
* Authentication or security requirements are not met.
* The AMP version cannot be rendered.

Always provide a complete HTML fallback so the email remains usable even when AMP is unavailable.
