# Email (EmailGenerator)

The [Email](https://docs.tonic.ai/app/generation/generators/generator-reference/email) generator scrambles the characters in an email address. It preserves formatting and keeps the @ and . characters.

### Link object structure <a href="#generator-api-email-link-object" id="generator-api-email-link-object"></a>

The Email generator does not support linking. It can be self-consistent, but not consistent with another column. You cannot configure differential privacy.

The `metadata` object is populated from the [`EmailMetadata`](https://app.tonic.ai/apidocs/index.html#/models/EmailMetadata) object. You can configure:

* The domain to use for all of the email addresses in the destination database.
* Domains for which to keep the email addresses as is in the destination database.
* Whether to replace invalid email addresses with valid ones.

```json
{
  "schema": "string",
  "table": "string",
  "column": "string",
  "path": "string",  //JSON fields only
  "dataType": "string",  //MongoDB, Amazon DynamoDB, and JSON fields only
  "metadata": {
    "presetId": "string",
    "generatorId": "EmailGenerator",
    "domain": "string",
    "excludedDomain": "string",
    "replaceInvalidEmails": boolean,
    "isConsistent": boolean,
    "encryptionProcessor": "x-on", //To use configured Structural data encryption
    "customValueProcessor": "string"  //If custom value processor applied
  }
}
```

### Example replacement <a href="#generator-api-email-replacement" id="generator-api-email-replacement"></a>

In the following example replacement for the Email generator, all of the destination email addresses use gmail.com as the domain.

Source email addresses from yahoo.com are not changed.

Invalid email addresses are replaced.

The generator is not consistent.

```json
{
  "name": "email_address",
  "schema": "public",
  "table": "users",
  "links": [
    {
      "schema": "public",
      "table": "users",
      "column": "email_address",
      "metadata": {
        "presetId": "EmailGenerator",
        "generatorId": "EmailGenerator",
        "domain": "gmail.com",
        "excludedDomain": "yahoo.com",
        "replaceInvalidEmails": true,
        "isConsistent": false
      }
    }
  ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tonic.ai/app/api/quick-start-guide/tonic-api-generator-assignment/generator-api-reference/generator-api-ref-email.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
