Code your own content code-content

On this page: Learn how to write or paste raw HTML in the Email Designer code editor to build email content, including how to add personalization and the available date and time functions.

Code your own lets you write or paste raw HTML to build email content directly in the Journey Optimizer Email Designer. Use this mode when you need full control over markup or when importing existing HTML.

You must have HTML skills, and once you choose this mode, you stay in the code editor—you cannot switch to the visual editor.

➡️ Discover this feature in video

NOTE
Code your own is not the same as the advanced HTML editor in the Email Designer. The advanced HTML editor lets you toggle between HTML view and the visual (Desktop) view at any time—not the code editor. Learn more about the advanced HTML editor.

Use the code editor use-code-editor

To create or edit email content using the code editor, follow these steps.

  1. From the Email Designer home page, select Code your own.

  2. Enter or paste your raw HTML code.

  3. Use the left pane to leverage Journey Optimizer personalization capabilities. Learn more

    note
    NOTE
    The personalization editor in the Email Designer has some function limitations compared to journey expressions. Learn more about date/time function limitations
  4. If you want to clear your email content and start your email from a new design, select Change your design from the options menu.

    note
    NOTE
    This action opens the selected template in the Email Designer. From there, you can either complete the design of your email, or go back to the code editor using the Switch to code editor option.
  5. Click the Preview button to check the message design and personalization using test profiles. Learn more

  6. Once your code is ready, click Save then go back to the message creation screen to finalize your message.

CAUTION
Images from Adobe Experience Manager Assets cannot be referenced when using the Code your own method. Store images referenced in your HTML code into a public location.

Date and time function limitations date-time-limitations

When using personalization in the Email Designer code editor, the now() function is not available for dynamic date calculations.

IMPORTANT
The now() function is not supported in the Email Builder’s expression language. While now() is available in journey conditions, it cannot be used within email content or the code editor.

Available alternatives:

Use the following functions to work with current date and time in email personalization:

  • getCurrentZonedDateTime() - Returns the current date and time with time zone information. This is the recommended alternative to now().

    Example: {%= getCurrentZonedDateTime() %} returns 2024-12-06T17:22:02.281067+05:30[Asia/Kolkata]

  • currentTimeInMillis() - Returns current time in epoch milliseconds.

    Example: {%= currentTimeInMillis() %}

Recommended workarounds:

If you need to perform date calculations in your email content:

  • Pre-calculate date fields - Calculate required date values in your data pipeline or profile attributes before sending the email, then reference these pre-calculated values in your personalization.

    Example: {%= profile.timeSeriesEvents._mobile.hotelBookingDetails.bookingDate %}

  • Use date manipulation functions - Use date/time functions like dayOfYear() or diffInDays() with date values from profile attributes.

    Example: {%= formatDate(profile.timeSeriesEvents._mobile.hotelBookingDetails.bookingDate, "MM/dd/YY") %}

  • Use computed attributes - Create computed attributes that perform complex date calculations, making the results available as profile attributes.

See Date and time functions for the full list of supported functions.

AI Knowledge Reference

This section contains structured knowledge intended to support interpretation, retrieval, and question answering related to this topic.

For complete understanding, this information should be combined with the documentation on this page. Neither source is intended to stand alone; the page describes the feature, while this section provides additional context that helps disambiguate terminology, intent, applicability, and constraints.

  • TL;DR: This page explains how to use the Code your own mode to write or paste raw HTML in the Email Designer code editor to build email content, add personalization, and work with date and time using the available functions and workarounds.

Intents:

  • Write or paste raw HTML to build email content using Code your own
  • Add personalization using the left pane of the code editor
  • Preview the message design and personalization using test profiles
  • Clear content and start a new design with Change your design
  • Work with current date and time using available functions and recommended workarounds

Glossary:

  • Code your own: A mode to write or paste raw HTML to build email content directly in the Email Designer; once chosen, you stay in the code editor and cannot switch to the visual editor (product-specific)
  • Advanced HTML editor: A different feature that lets you toggle between HTML view and the visual (Desktop) view at any time; not the same as Code your own (product-specific)
  • getCurrentZonedDateTime(): Returns the current date and time with time zone information; the recommended alternative to now() (product-specific)
  • currentTimeInMillis(): Returns current time in epoch milliseconds (product-specific)

Guardrails:

  • You must have HTML skills; once you choose Code your own, you stay in the code editor and cannot switch to the visual editor.
  • The now() function is not supported in the Email Builder’s expression language; while available in journey conditions, it cannot be used within email content or the code editor.
  • The personalization editor in the Email Designer has some function limitations compared to journey expressions.
  • Images from Adobe Experience Manager Assets cannot be referenced when using Code your own; store referenced images in a public location.

Terminology:

  • Canonical name: Code your own — Acronym: n/a — variants: code editor, code your own content
  • Synonyms: “Code your own” = “code editor mode”
  • Do not confuse: “Code your own” (code editor only, no switch to visual editor) ≠ “advanced HTML editor” (toggles between HTML view and visual Desktop view)

FAQ:

  • Q: Can I switch from the code editor to the visual editor? — No; once you choose Code your own, you stay in the code editor. (The separate advanced HTML editor does allow toggling between HTML and Desktop views.)
  • Q: Can I use now() in email content or the code editor? — No; now() is not supported in the Email Builder’s expression language, though it is available in journey conditions. Use getCurrentZonedDateTime() (recommended) or currentTimeInMillis().
  • Q: Can I reference AEM Assets images in Code your own? — No; store images referenced in your HTML code in a public location.
  • Q: How can I perform date calculations in email content? — Pre-calculate date fields in your data pipeline or profile attributes, use date manipulation functions with profile date values, or use computed attributes.
recommendation-more-help
journey-optimizer-help