> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.chrisp.chat/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How to automatically set users email addresses

__Learn how to set an authenticated visitor email address from your website code.__

When your website already knows the visitor email, you can pass it to Crisp so the customer does not need to type it again before starting a conversation.

---

# Set the visitor email

Use the ****$crisp JavaScript SDK**** after the Crisp chatbox snippet is available on the page.

```
// Replace this value with the email from your own authenticated user data.$crisp.push(["set", "user:email", ["user@example.com"]]);
```

Crisp expects a valid email address. If the value is invalid, the SDK may raise an error unless safe mode is enabled.

---

# Example with PHP

When injecting the email from a backend template, escape it safely before printing it into JavaScript.

```
<script>  $crisp.push(["set", "user:email", [<?php echo json_encode($user_email); ?>]]);</script>
```

This example assumes ****$user_email**** contains the authenticated user email.

---

# Read the current email

You can read the visitor email from the SDK with:

```
var visitorEmail = $crisp.get("user:email");
```

| Read the [$crisp Methods documentation](https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/dollar-crisp/) for more user setters and getters.