# Use your own HTML (Custom HTML)

> Paste your own email HTML into a Mail Niaga template with Custom HTML, edit the code, then click Save HTML.
>
> Source: https://docs.mailniaga.com/custom-html-template/

With Custom HTML, you can use your own email HTML code. An example is an email that you designed in another application. Mail Niaga has no upload button for templates. You must paste the HTML code directly into the editor.

> **Caution**
> A Custom HTML template cannot go back to the email builder. After you save Custom HTML, the template stays an HTML template.

## Change a builder template to Custom HTML

Do these steps for a template that you made from the gallery.

1. In the left sidebar, click **Campaigns** → **Templates**.
2. Click **...** on the template card, then click **Edit as Custom HTML**.

   *(Screenshot: The menu of a builder template card with Edit as Custom HTML marked)*

3. The **Custom HTML** page opens with an empty editor. Paste your HTML code (see the steps below).
4. Click **Save HTML**.
5. Mail Niaga asks "Switch to Custom HTML?". Click **Switch to Custom HTML** to continue, or **Cancel** to stop.

*(Screenshot: The Switch to Custom HTML? confirmation above the empty editor, with the Cancel and Switch to Custom HTML buttons)*

If you want to keep the builder version, click **Copy** on the template first. Then change the copy to Custom HTML. See [Email templates: overview](https://docs.mailniaga.com/templates/).

## Edit a Custom HTML template

A Custom HTML template has an **Edit HTML** button on its card and in the **...** menu.

*(Screenshot: The menu of a Custom HTML template card with Edit HTML marked)*

The **Custom HTML** page has a visual editor with the menus **Edit**, **Insert**, **View**, **Format**, **Table** and **Tools**. You can change text, links and images directly here.

*(Screenshot: The Custom HTML page with the visual editor and the Edit source button)*

## Paste HTML from another application

Use the code mode when you have complete HTML from another application or from a designer.

1. On the **Custom HTML** page, click **Edit source**.
2. Delete the code that is there, then paste your HTML code.
3. Click **Visual editor** to see the email. The **Dark** or **Light** button only changes the colour of the code editor.
4. Click **Save HTML**.

*(Screenshot: Edit source mode with HTML code, the Dark button and the Visual editor button)*

To leave and not save, click **Cancel**.

*(Screenshot: The personalisation tag message, and the Cancel and Save HTML buttons)*

## Personalisation tags in HTML

You can put tags in your HTML code. Mail Niaga replaces the tags when it sends the email.

| Tag | What it does |
|---|---|
| `{{ SUBSCRIBER_FIRST_NAME }}` | The first name of the subscriber. |
| `{{ UNSUBSCRIBE_URL }}` | The unsubscribe link. |
| `{{ WEB_VIEW_URL }}` | A link that opens the email in a browser. |

Mail Niaga has other tags too, for example for the email address of the subscriber and the campaign name. See [Use personalisation tags in emails](https://docs.mailniaga.com/personalisation-tags/).

## Tips

This advice helps you get good results with your own HTML:

- **Put an unsubscribe link in each email.** Use `{{ UNSUBSCRIBE_URL }}`. With this link, a recipient can unsubscribe and does not have to report your email as spam. See [Put an unsubscribe link in your emails](https://docs.mailniaga.com/unsubscribe-link/).
- **Use HTML that is made for email.** Most email applications show table layouts better. They also show CSS styles on each element (inline CSS) better.
- **Keep a copy of your HTML outside Mail Niaga.** If you must change many parts, edit the original file and paste the code again.

## Common issues

### Can I change a Custom HTML template back to the email builder?

No. After you save Custom HTML, the template stays an HTML template. If you want to keep the builder version, copy the template first with Copy.

### Why does the page go back to Custom HTML when I click the Edit tab?

The template is a Custom HTML template. This type of template cannot open in the email builder, so Edit takes you back to the Custom HTML page.

### How can I upload an HTML file from another application?

Templates have no upload button. Open the HTML file in a text editor and copy all the code. Then paste the code in Edit source mode and click Save HTML.
