# Send email from Actions

**URL:** <https://community.auth0.com/t/send-email-from-actions/105756>\
**Category:** Get Help\
**Tags:** emails, management-api\
**Created:** [April 28, 2023, 3:39pm UTC](https://community.auth0.com/t/send-email-from-actions/105756 "2023-04-28T15:39:20Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [April 28, 2023, 5:43pm UTC](https://community.auth0.com/t/send-email-from-actions/105756/3 "2023-04-28T17:43:36Z")

</div>

Hi @jeanbaptiste.marie,

Welcome to the Auth0 Community!

I understand that you are trying to send a password reset email to a user whenever they log in and have not changed their password for a given time.

For this, I recommend using a Post-Login Action with the Authentication API, specifically calling the [`POST /dbconnections/change_password` endpoint](https://auth0.com/docs/api/authentication#change-password).

I have written a code snippet below to make an Axios request to the Change Password endpoint. From here, you will need to write the code to compare the user’s last password change to a given time, and if it satisfies, you can call the `sendPasswordResetEmail()` function.

```auto
exports.onExecutePostLogin = async (event, api) => {
  var axios = require("axios").default;

  const sendPasswordResetEmail = () => {
    var options = {
      method: 'POST',
      url: 'https://YOUR_DOMAIN}/dbconnections/change_password',
      headers: {'content-type': 'application/json'},
      data: {
        client_id: 'event.client.client_id',
        email: 'event.user.email',
        connection: 'event.connection.name'
        
      }
    };
    try{
    axios.request(options).then(function (response) {
      console.log("Response: ",response.data);
    })
    }catch(error){
      console.error(error)
    }
  }
  /*
  Check if the user has not changed their password for a given time.
  If this is true, call the sendPasswordResetEmail() function.
 */
}

```

Please let me know how this goes for you.

Thanks,  
Rueben

---

_[View the full topic](https://community.auth0.com/t/send-email-from-actions/105756)._
