# useSetEmail | @account-kit/react

> Overview of the useSetEmail hook from @account-kit/react

{/* This file is auto-generated by TypeDoc. Do not edit manually. */}

```ts
function useSetEmail(mutationArgs?): UseSetEmailResult;
```

Defined in: [account-kit/react/src/hooks/useSetEmail.ts:76](https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/react/src/hooks/useSetEmail.ts#L76)

A custom hook to set an email address for an already authenticated account.

**Note:** You should first use the `useSendVerificationCode` hook to send
a verification code to the email address before calling this hook.

## Example

```ts twoslash
import { useSetEmail, useSendVerificationCode } from "@account-kit/react";

// First, send verification code
const { sendVerificationCode } = useSendVerificationCode();

const { setEmail, isSettingEmail, error } = useSetEmail({
  onSuccess: () => {
    // do something when email is successfully set
  },
  onError: (error) => console.error(error),
});

// Step 1: Send verification code to email
await sendVerificationCode({
  type: "email",
  contact: "user@example.com",
});

// Step 2: Update email using verification code
setEmail({
  verificationCode: "123456", // code user received
});

// DEPRECATED: Use with just email string (for backward compatibility)
setEmail("user@example.com");
```

## Parameters

<table>
  <thead>
    <tr>
      <th align="left">Parameter</th>
      <th align="left">Type</th>
      <th align="left">Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `mutationArgs?`
      </td>

      <td>
        `Partial`\<`Omit`\<`UseMutationOptions`\<`void`, `Error`, [`SetEmailParams`](../type-aliases/SetEmailParams), `unknown`>, `"mutationFn"` | `"mutationKey"`>>
      </td>

      <td>
        Optional arguments for the setEmail mutation
      </td>
    </tr>

  </tbody>
</table>

## Returns

[`UseSetEmailResult`](../type-aliases/UseSetEmailResult)

An object containing functions and state for setting the email