I am trying to send an AMP email using v3 API via Postman. The email is sent and I can see it fine in preview in Gmail inbox landing page, but when I open the email the amp part doesn't load and it only displays 'Hello' and not the template part. Sender email is whitelisted.
{
"personalizations": [
{
"to": [
{
"email": "[email protected]",
"name": "Name Surname"
}
],
"subject": "this is an AMP email"
}
],
"content": [
{
"type": "text/x-amp-html",
"value": "<!doctype html><html amp4email data-css-strict><head><meta charset=\"utf-8\"><script async src=\"https://cdn.ampproject.org/v0.js\"></script><style amp4email-boilerplate>body{visibility:hidden}</style><style amp-custom>h1 {margin: 1rem;}</style></head><body>Hello</body></html>"
},
{
"type": "text/html",
"value": "HTML content"
}
],
"template_id": "f-5kk76740d084490a88d376fc1b1b277g",
"from": {
"email": "[email protected]",
"name": "Name 2"
}
}
I am unable to figure why it shows in preview but does not load. However when I try to forward it loads the correct part from the template.
It looks like the amp part of your email (type: text/x-amp-html) only contains "Hello" in the body. When gmail finds a valid amp part, it renders that INSTEAD of any other content. So Gmail is rendering the AMP part, and not rendering the template. Your entire email has to be written into the AMP framework and sent as the AMP part. The HTML content will only be shown in email clients that don't support AMP (ie Apple Mail or Outlook)