# Send email to admin after user signed up

**URL:** <https://community.auth0.com/t/send-email-to-admin-after-user-signed-up/7829>\
**Category:** Get Help\
**Tags:** email, sign-up\
**Created:** [August 12, 2017, 2:38am UTC](https://community.auth0.com/t/send-email-to-admin-after-user-signed-up/7829 "2017-08-12T02:38:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulocheque](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/paulocheque/32/7850_2.png) [@paulocheque](https://community.auth0.com/u/paulocheque)\
**Post date:** [August 12, 2017, 2:38am UTC](https://community.auth0.com/t/send-email-to-admin-after-user-signed-up/7829/1 "2017-08-12T02:38:03Z")

</div>

I’m using Auth0 - JS library to sign up the users. I created a rule to send an e-mail after the user sign up, but this rule has not being called.

Rule code:

```
function(user, context, callback) {
  console.log('THIS LOG MESSAGE DOES NOT APPEAR ON AUTH0 LOGS');

  user.app_metadata = user.app_metadata || {};
  if (!user.app_metadata.signedUp) {
    return callback(null, user, context);
  }
  ... SEND EMAIL WITH SENDGRID HERE

```

Sign up code:

```
export const auth0 = require('auth0-js');
auth.redirect.signupAndLogin( ... )

```

Ref: [Auth0 Community](https://auth0.com/forum/t/how-to-send-email-to-admin-when-user-registers/2987/2)

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [August 14, 2017, 7:26pm UTC](https://community.auth0.com/t/send-email-to-admin-after-user-signed-up/7829/2 "2017-08-14T19:26:49Z")

</div>

Technically, I could not reproduce the situation regarding the `console.log` statement as the first statement of a rule. The message was correctly shown on the Webtask Real-time Logs extension; have in mind that these messages will not appear in the _Logs_ section of the Dashboard which is meant to logs associated with known events.

In addition, the logic of the rule that you included is implemented in a way that does not seem correct as you seem to be performing the signup directly from the client application using the public endpoint for signup. This means that the user will be created without `app_metadata`, which then causes the rule to initialize it to an empty object `{ }`.

**If the `app_metadata` is an empty object then `!user.app_metadata.signedUp` will always evaluate to `true`** because the `signedUp` property won’t exist which is a falsy value that is negated to become `true` and in such way terminate rule execution without sending the email. If you’re setting the `signedUp`property after sending the email, then you should fix the first condition and remove the negation operator.

---

<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 2, 2018, 5:55am UTC](https://community.auth0.com/t/send-email-to-admin-after-user-signed-up/7829/3 "2018-03-02T05:55:54Z")

</div>


