MailGraf
TR
Campaigns

Add a code block

Show coloured code in an email: pick the language, paste the code, shorten long code and choose a theme.

Updated 8 Oct 2026Open Campaigns in app

A code block shows code in the email as coloured text. The code is not run; the recipient reads it and copies it from the web version of the email.

Add the block

  1. In the editor, click the Content icon on the left

    Drag the Code block from the More group onto the email and drop it. The left panel switches to the block's Content tab.
  2. Pick the code's language under Language

    Colours follow the language you choose. If your language is not listed, pick Plain text.
  3. Paste the code into the code area

    Up to 500 lines are accepted. Longer code is not saved and the panel warns you.
  4. For long code, switch on Shorten in the email

    Type how many lines the email should show in Lines shown. The remaining lines open in the web version of the email.
  5. Set the title bar and line numbers

    With Title bar on, the name you type in File name appears above the code. Line numbers puts a number at the start of each line.
  6. Choose a theme on the Style tab

    There are six options under Theme: Paper, One Dark, Dracula, Solarized, Nord and Brand. The Brand theme takes its colours from your global button colour.

With View in browser link on, a link appears above the code. When the recipient clicks it, the web version of the email opens; the full code and a Copy button are there.

Long lines on phones

A line longer than 80 characters does not fit a phone screen. On the Style tab, under Long lines, Wrap moves the line onto the next row and Clip hides the part that overflows.

Frequently asked questions

Can the recipient copy the code from the email?

There is no copy button inside the email. Keep View in browser link on; the recipient clicks Copy in the web version of the email.

Does the code run on the recipient's computer?

No. The code is shown as text only; it is not run anywhere.

How many lines of code can I add?

500 lines. Shorten longer code or link to the full version.

Related articles

Was this helpful?

Still need help?

Write to us and a person will answer.

Contact us
MailGraf

Professional email marketing platform.

We Love Email

Don't miss out

Get the latest email marketing tips and exclusive updates.

PECRGDPRISO27001

MailGraf is a trading name of MailGraf Digital Ltd, registered in England and Wales, No. 13282175. ICO ZB250899.