> ## Documentation Index
> Fetch the complete documentation index at: https://docs.allgoodhq.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Editing an email's code

> Open an email's MJML source, change it by hand or upload a file, check it, and save it as a new version.

Most emails never need this. You describe a change to Mary, and she makes it. **Edit Source** is for the times you want to change the email's code yourself, such as adjusting spacing, fixing a layout quirk, or pasting in markup you already have.

The code is **MJML**, the email-building language allGood uses. If it's new to you, start with [What MJML is](https://docs.allgoodhq.com/mk/content/email/components/what-mjml-is.md).

> [!NOTE]
>
> Changing the words in an email is not a code edit. The email's copy lives in its own document, and the code only points to it. To change a headline or a button label, ask Mary to change the copy. There's no editor for a copy document yet. See [Copy and variants](https://docs.allgoodhq.com/mk/content/copy-and-variants.md).

## Open the code

Open the email and select **Edit Source** in the left menu, under **Author**. You see the email's `email.mjml` file with line numbers, a check on whether it can be saved, and a preview.

![Edit Source for an email, showing the email.mjml code, the check result, and the Upload a file, Save and Save and publish buttons](https://mintcdn.com/allgoodtechnologyinc/kRFN6t6lZA4SD0Ea/images/mk/content/email/emails/edit-source-editor.png?fit=max\&auto=format\&n=kRFN6t6lZA4SD0Ea\&q=85\&s=c715cc0fd33a1e226a3746cedeab728e)

Edit Source for an email: the code, the check, and the buttons to save it.

If you don't have permission to edit emails, the screen opens read-only with its buttons turned off, and says so at the top.

## Make a change

**1. Edit the code**

Type in the editor, or select **Upload a file** to replace the code with an MJML file from your computer. Uploading fills the editor but does not save anything yet.

**2. Read the check**

A few moments after you stop typing, the box above the editor checks your code. It reads **This source would save** when the code passes every check a generated email is held to. If it finds a problem, it lists what to fix, and you can't save until it's fixed.

**3. Look at the preview**

Below the editor, the preview shows what saving would produce. Switch between **Email** and **Plain text** to see both parts of the message.

![The Edit Source preview, with Email and Plain text tabs and the top of the email](https://mintcdn.com/allgoodtechnologyinc/kRFN6t6lZA4SD0Ea/images/mk/content/email/emails/edit-source-preview.png?fit=max\&auto=format\&n=kRFN6t6lZA4SD0Ea\&q=85\&s=82306d89c4e0a3f02ffd33664a8fa1e7)

The preview shows the email as your code would build it.

Tokens such as `{{ asset.copy.content.headline.value }}` and `{{ person.firstName }}` appear as written here. They are filled in when the email is sent. To see real values, use [Previewing and testing an email](https://docs.allgoodhq.com/mk/content/email/emails/previewing-and-testing-an-email.md).

**4. Save it**

Select **Save** to keep your change as a new version without putting it live. Select **Save and publish** to save it and publish it in one step. Both buttons stay off until you've changed something, and **Save and publish** needs permission to publish.

Saving builds the MJML into the HTML that is sent, and builds the plain-text part from that HTML.

When this works, a message confirms the new version, for example "Saved as v4. Publish it to go live," and the page shows that version as the latest saved one.

## What happens to the live email

Nothing changes in a live email when you save. The email keeps sending its last published version until you publish the new one. Every save is its own version, so you can try a change and undo it by publishing an earlier version. See [Publishing and versions](https://docs.allgoodhq.com/mk/content/approvals.md).

## Good to know

* **It's the email's own code.** A change here affects this email only. To change every email built from a template, edit the template's code instead. See [Changing an email template](https://docs.allgoodhq.com/mk/content/email/templates/changing-an-email-template.md).
* **Components can't be edited by hand.** You can view the code behind a component, but changes to one go through Mary.
* **Keep the copy tokens.** If you delete a `{{ asset.copy… }}` token, that text no longer appears in the email, even though it's still in the copy document.

## If the email will not save

If **Save** stays off, check that you changed something, that you have permission to edit, and that the check above the editor says the source would save. If you're still stuck, contact [support@allgoodhq.com](mailto:support@allgoodhq.com).

## Related articles

* [What MJML is](https://docs.allgoodhq.com/mk/content/email/components/what-mjml-is.md)
* [Previewing and testing an email](https://docs.allgoodhq.com/mk/content/email/emails/previewing-and-testing-an-email.md)
* [Creating an email](https://docs.allgoodhq.com/mk/content/email/emails/creating-an-email.md)
* [Changing an email template](https://docs.allgoodhq.com/mk/content/email/templates/changing-an-email-template.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.