---
updatedAt: 2026-04-20T19:35:58.000Z
---

# Format 2FA emails by using CSS

When it comes to the HTML version of your 2FA messages you can use inline CSS to add your own aesthetic flair to those messages. 

<br>

[block:callout]
{
  "type": "info",
  "body": "Sorry, but you can’t use CSS for text messages or for plain-text email messages, and for good reason: those platforms don’t support CSS. (Or much else in the way of formatting.)"
}
[/block]

<br>

For example, in the following request body we’ve added some CSS that displays our message using red text:

[block:code]
{
  "codes": [
    {
      "code": "{\n    \"sms\": \"{{site_name} }: Your secure access code is {{code} }. Do not share this code with anyone.\n{{site_name}} will never ask you for it.\",\n    \"email\": {\n        \"subject\": \"{{site_name}} One Time Code\",\n        \"textBody\": \"{{site_name}}: Your secure access code is {{code}}. Do not share this code\nwith anyone. {{site_name}} will never ask you for it.\",\n        \"htmlBody\": \"<p style='color:red'>{{site_name}}: Your secure access code is {{code}}.\nDo not share this code with anyone. {{site_name}} will never ask you for it.</p>\"\n    },\n    \"_self\": \"/config/79y4mqf2rt3bxs378kw5479xdu/flows/moreJTL/locales/en-US/\n2faMessages/secondFactor\"\n}",
      "language": "text"
    }
  ]
}
[/block]

After making the API call, here’s what the users see in their inboxes:

![](https://techdocs.akamai.com/identity-cloud/img/oidc/hosted-login-v2/two-factor-authentication-messages/2fa-messages-red-text.png)

You can also include images in your HTML emails. Note the Akamai logo at the bottom of this message:

![](https://techdocs.akamai.com/identity-cloud/img/oidc/hosted-login-v2/two-factor-authentication-messages/2fa-messages-logo.png)

That image was added by using the following request body:

[block:code]
{
  "codes": [
    {
      "code": "{\n  \"sms\": \"{{site_name}}: Your secure access code is {{code}}. Do not share this code with anyone.\n {{site_name}} will never ask you for it.\",\n  \"email\": {\n    \"subject\": \"{{site_name}} One Time Code\",\n    \"textBody\": \"{{site_name}}: Your secure access code is {{code}}. Do not share this code with anyone.\n {{site_name}} will never ask you for it.\",\n    \"htmlBody\": \"<p>{{site_name}}: Your secure access code is {{code}}. Do not share this code with\nanyone. {{site\\_name}} will never ask you for it.</p><p><img src='https://www.akamai.com/us/en/multimedia/documents/media-resources/akamai-logo.jpg?imwidth=320'></p>\"\n    }\n}",
      "language": "text"
    }
  ]
}
[/block]

# Sibling pages

* [Enable and disable 2FA](https://techdocs.akamai.com/identity-cloud/docs/enable-and-disable-two-factor-authentication.md)
* [Modify 2FA registration forms](https://techdocs.akamai.com/identity-cloud/docs/modify-the-traditionalregistrationform-and-the-socialregistrationform-forms.md)
* [Require 2FA on every login](https://techdocs.akamai.com/identity-cloud/docs/require-two-factor-authentication-on-every-login.md)
* [Add 2FA messages to a flow](https://techdocs.akamai.com/identity-cloud/docs/add-the-two-factor-authentication-messages-to-your-flow.md)
* [View 2FA messages](https://techdocs.akamai.com/identity-cloud/docs/view-your-two-factor-authentication-messages.md)
* [Modify a 2FA message](https://techdocs.akamai.com/identity-cloud/docs/modify-a-two-factor-authentication-message.md)
* [Create a localized 2FA message](https://techdocs.akamai.com/identity-cloud/docs/create-a-localized-version-of-a-two-factor-authentication-message.md)