# Get email notifications on login (api.sendEmail in action)

**URL:** <https://community.auth0.com/t/get-email-notifications-on-login-api-sendemail-in-action/194577>\
**Category:** Get Help\
**Tags:** apis, application\
**Created:** [November 17, 2025, 10:48am UTC](https://community.auth0.com/t/get-email-notifications-on-login-api-sendemail-in-action/194577 "2025-11-17T10:48:58Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![vlad.murarasu](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vlad.murarasu/32/72793_2.png) [@vlad.murarasu](https://community.auth0.com/u/vlad.murarasu)\
**Post date:** [November 17, 2025, 1:54pm UTC](https://community.auth0.com/t/get-email-notifications-on-login-api-sendemail-in-action/194577/3 "2025-11-17T13:54:17Z")

</div>

Hi @axel-insightsphere,

The error `api.sendEmail is not a function` occurs because Auth0 Actions do not have a built-in method to send emails. The `api` object in Actions is strictly for manipulating the authentication transaction (like denying access or adding claims).

To send an email (like an admin notification), you must use an **external email provider** (such as SendGrid, AWS SES, or Mailgun) and call their API from within your Action.

Additionally, your code snippet uses `onExecutePostUserRegistration`, which runs only once when a user first creates an account. Still, you’re stating that you want to be “informed of any login.”, which means you will need to use the **Post Login** trigger instead.

This other community post provides an example code snippet that can help.

> [@Send email from Actions](https://community.auth0.com/t/send-email-from-actions/105756/3):
>
> 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 com…

If you have any further questions, please don’t hesitate to reach out.

Have a good one,  
Vlad

---

_[View the full topic](https://community.auth0.com/t/get-email-notifications-on-login-api-sendemail-in-action/194577)._
