# Change user e-mail address in DB connection

**URL:** <https://community.auth0.com/t/change-user-e-mail-address-in-db-connection/58969>\
**Category:** Get Help\
**Tags:** user\
**Created:** [March 5, 2021, 4:10pm UTC](https://community.auth0.com/t/change-user-e-mail-address-in-db-connection/58969 "2021-03-05T16:10:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spacefight](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@Spacefight](https://community.auth0.com/u/Spacefight)\
**Post date:** [March 5, 2021, 4:10pm UTC](https://community.auth0.com/t/change-user-e-mail-address-in-db-connection/58969/1 "2021-03-05T16:10:04Z")

</div>

I create users only via the Mgmt API. I do only set fields ‘email’, ‘password’ and ‘connection’. Users receive an automatic email from Auth0 to verify their address.

Right now I want to update a user record when he wishes to change his email address. I’ll do this with a lookup first and then an update of the user by passing only the ‘email’ field with the new value.

Then, something not expected happens:

- The user is still visbile with the old address in the “Name” field via the dashboard.
- The user has the new address visible as “Pending”
- The user can login with the new address
- There is no verification mail sent to the new address
- Subsequent queries to find the new address

My questions:

- Why is the address set to pending?
- Why is the email verification not sent out?
- Why is the “Name” field not updated here as well as while user creation?

---

<div class="post-metadata">

**Author:** ![supun](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/supun/32/17069_2.png) [@supun](https://community.auth0.com/u/supun)\
**Post date:** [March 5, 2021, 4:29pm UTC](https://community.auth0.com/t/change-user-e-mail-address-in-db-connection/58969/2 "2021-03-05T16:29:16Z")

</div>

Hi @Spacefight,

Welcome to Auth0 Community! Here are the answers to your questions!

> 1. Why is the address set to pending?

Address is set to pending because the user hasn’t verified their email address.

> 1. Why is the email verification not sent out?

The verification email won’t be sent unless you specify `verify_email:true` in your PATCH request sent to `/api/v2/users/{id}` endpoint. (Read more in the Management API Doc’s Body Schema section: [Auth0 Management API v2](https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id))

> 1. Why is the “Name” field not updated here as well as while user creation?

When you create a user using the Management API by just specifying the email, password, and connection; Auth0 will automatically set the email address as the user’s Name. After that, if you want to change the Name, you have to do it manually.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![Spacefight](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@Spacefight](https://community.auth0.com/u/Spacefight)\
**Post date:** [March 5, 2021, 4:40pm UTC](https://community.auth0.com/t/change-user-e-mail-address-in-db-connection/58969/4 "2021-03-05T16:40:13Z")

</div>

I noticied that when I trigger the verification email with the client\_id of my application, the template in the email looks fine - if I do not add the client\_id, the email template uses lowercase of the subdomain of my auth0 user account.

Can I trigger the correct template with the verify\_email param set in the update call since I can’t pass the client\_id along (I guess).

---

<div class="post-metadata">

**Author:** ![supun](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/supun/32/17069_2.png) [@supun](https://community.auth0.com/u/supun)\
**Post date:** [March 6, 2021, 1:51am UTC](https://community.auth0.com/t/change-user-e-mail-address-in-db-connection/58969/5 "2021-03-06T01:51:37Z")

</div>

@Spacefight , can you elaborate more on what you meant by “lowercase of the subdomain”? is the verification email sent when using the `/api/v2/users/{id}` endpoint is different than `/api/v2/jobs/verification-email` endpoint?

---

<div class="post-metadata">

**Author:** ![Spacefight](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@Spacefight](https://community.auth0.com/u/Spacefight)\
**Post date:** [March 8, 2021, 7:03am UTC](https://community.auth0.com/t/change-user-e-mail-address-in-db-connection/58969/6 "2021-03-08T07:03:59Z")

</div>

Yes, sure.  
If I set verify\_email to true when using the PHP SDK using users()-\>update() calls, the mail template received show the following sentence:

# Welcome to myapplicationname!

Where myapplicationname is the subdomain from my auth0 account.

If I do not set the verify\_email flag and call the MgmtApi a second time via jobs-\>sendVerificationEmail() and pass a long the client\_id of the application, then the mail template received shows the following sentence:

# Welcome to MyApplicationName!

Where MyApplicationName is indeed coming from the application configuration.

I would advise users to always choose a second MgmtApi call to trigger the verification email or the template looks not 100% correct to the end user.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [March 8, 2021, 7:19am UTC](https://community.auth0.com/t/change-user-e-mail-address-in-db-connection/58969/7 "2021-03-08T07:19:53Z")

</div>

Thanks for sharing that with the rest of community!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 23, 2021, 7:20am UTC](https://community.auth0.com/t/change-user-e-mail-address-in-db-connection/58969/8 "2021-03-23T07:20:06Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
