# Multiple welcome emails being sent

**URL:** <https://community.auth0.com/t/multiple-welcome-emails-being-sent/9028>\
**Category:** Get Help\
**Tags:** emails, welcome-email, email\
**Created:** [December 20, 2017, 2:24pm UTC](https://community.auth0.com/t/multiple-welcome-emails-being-sent/9028 "2017-12-20T14:24:16Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhilash1in](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@abhilash1in](https://community.auth0.com/u/abhilash1in)\
**Post date:** [December 20, 2017, 2:24pm UTC](https://community.auth0.com/t/multiple-welcome-emails-being-sent/9028/1 "2017-12-20T14:24:16Z")

</div>

I am using the Gmail social connection for login and setup a welcome email which is sent via SMTP (Gmail) email provider. However, for some users, they are receiving two to three welcome emails in a short time (within 2-3 minutes) after they login for the first time. Is this a bug or am I doing something wrong?

**EDIT** :  
Seems like from the past few days, a welcome email is being sent to users every time they login.

Here are the logs of a user who has been sent 3 welcome emails - 1 email at each of the 3 timings mentioned in the logs (All 3 are recorded as a `Success Login` event). `client_id`, `ip`, `user_id`, `user_name` values are hidden to protect privacy but the values are the same in all 3 logs

```
{
  "date": "2017-12-20T01:46:26.644Z",
  "type": "s",
  "connection": "google-oauth2",
  "connection_id": "con_c94TX4W5q5kStnnY",
  "client_id": "<HIDDEN>",
  "client_name": "Birthday Tracker",
  "ip": "<HIDDEN>",
  "user_agent": "Mozilla/5.0 (iPad; CPU OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13G36 Safari/601.1",
  "details": {
    "prompts": 
      {
        "name": "oauth2-authenticate",
        "initiatedAt": 1513734360301,
        "completedAt": 1513734386331,
        "timers": {
          "rules": 297
        },
        "connection": "google-oauth2",
        "elapsedTime": 26030
      }
    ],
    "initiatedAt": 1513734044354,
    "completedAt": 1513734386641,
    "elapsedTime": 342287,
    "stats": {}
  },
  "user_id": "<HIDDEN>",
  "user_name": "<HIDDEN>",
  "strategy": "google-oauth2",
  "strategy_type": "social",
  "auth0_client": {
    "name": "lock.js",
    "version": "10.18.0",
    "lib_version": "8.7.0"
  },
  "log_id": "49579568688084788852716023226483068531291786803790479362"
}

```

Log 2

```
{
  "date": "2017-12-20T01:32:58.534Z",
  "type": "s",
  "connection": "google-oauth2",
  "connection_id": "con_c94TX4W5q5kStnnY",
  "client_id": "<HIDDEN>",
  "client_name": "Birthday Tracker",
  "ip": "<HIDDEN>",
  "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_1 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) Version/11.0 Mobile/15C153 Safari/604.1",
  "details": {
    "prompts": 
      {
        "name": "oauth2-authenticate",
        "initiatedAt": 1513733456119,
        "completedAt": 1513733578213,
        "timers": {
          "rules": 302
        },
        "connection": "google-oauth2",
        "elapsedTime": 122094
      }
    ],
    "initiatedAt": 1513733450358,
    "completedAt": 1513733578530,
    "elapsedTime": 128172,
    "stats": {}
  },
  "user_id": "<HIDDEN>",
  "user_name": "<HIDDEN>",
  "strategy": "google-oauth2",
  "strategy_type": "social",
  "auth0_client": {
    "name": "lock.js",
    "version": "10.18.0",
    "lib_version": "8.7.0"
  },
  "log_id": "49579568688084788852716023168521120109868335428446191618"
}

```

Log 3

```
{
  "date": "2017-12-20T01:42:58.247Z",
  "type": "s",
  "connection": "google-oauth2",
  "connection_id": "con_c94TX4W5q5kStnnY",
  "client_id": "<HIDDEN>",
  "client_name": "Birthday Tracker",
  "ip": "<HIDDEN>",
  "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_1 like Mac OS X) AppleWebKit/604.4.7 (KHTML, like Gecko) Version/11.0 Mobile/15C153 Safari/604.1",
  "details": {
    "prompts": 
      {
        "name": "oauth2-authenticate",
        "initiatedAt": 1513734144286,
        "completedAt": 1513734177943,
        "timers": {
          "rules": 286
        },
        "connection": "google-oauth2",
        "elapsedTime": 33657
      }
    ],
    "initiatedAt": 1513734101145,
    "completedAt": 1513734178244,
    "elapsedTime": 77099,
    "stats": {}
  },
  "user_id": "<HIDDEN>",
  "user_name": "<HIDDEN>",
  "strategy": "google-oauth2",
  "strategy_type": "social",
  "auth0_client": {
    "name": "lock.js",
    "version": "10.18.0",
    "lib_version": "8.7.0"
  },
  "log_id": "49579568688084788852716023212244340227870670021730500610"
}

```

---

<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:** [December 20, 2017, 5:35pm UTC](https://community.auth0.com/t/multiple-welcome-emails-being-sent/9028/2 "2017-12-20T17:35:56Z")

</div>

**UPDATE:**

The logs you provided allowed me to trace the end-user in question and I found out that the user did not have login count information in the user profile. There may be other users in the same situation so this could explain why they receive welcome emails at each login. I could not reproduce this in my test tenants so the situation might be specific only to certain accounts or dependent of configuration, however, I reported this internally for further analysis and will update my answer again when I have additional information.

Meanwhile, you may want to consider disabling the welcome email template entirely given that if my theory is right those users would continue to receive welcome emails in future logins due to the missing login count information.

* * *

~~There is no bug that I’m aware related to multiple welcome emails~~ ; in relation to doing something specific that is causing that behavior it’s hard to tell with limited information. You should review the logs to see if there’s anything suspicious happening for those users and also update your question with the log entries in questions.

---

<div class="post-metadata">

**Author:** ![abhilash1in](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@abhilash1in](https://community.auth0.com/u/abhilash1in)\
**Post date:** [December 20, 2017, 7:04pm UTC](https://community.auth0.com/t/multiple-welcome-emails-being-sent/9028/3 "2017-12-20T19:04:57Z")

</div>

I went through the logs and I did not find anything strange. I have several instances where users have been sent multiple welcome emails and I am being threatened that my email ID will be reported as spam. There must be something wrong on Auth0’s side.

---

<div class="post-metadata">

**Author:** ![abhilash1in](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@abhilash1in](https://community.auth0.com/u/abhilash1in)\
**Post date:** [December 20, 2017, 7:18pm UTC](https://community.auth0.com/t/multiple-welcome-emails-being-sent/9028/4 "2017-12-20T19:18:11Z")

</div>

I have updated the question with the logs.

---

<div class="post-metadata">

**Author:** ![abhilash1in](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@abhilash1in](https://community.auth0.com/u/abhilash1in)\
**Post date:** [December 21, 2017, 10:06pm UTC](https://community.auth0.com/t/multiple-welcome-emails-being-sent/9028/5 "2017-12-21T22:06:13Z")

</div>

@jmangelo Have you had the time to look into this?

---

<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:** [December 27, 2017, 12:14am UTC](https://community.auth0.com/t/multiple-welcome-emails-being-sent/9028/6 "2017-12-27T00:14:21Z")

</div>

@abhilash1in I reviewed the situation again now with more context information (thanks for sharing the logs) and found an edge case that might explain this; I will update my answer.

---

<div class="post-metadata">

**Author:** ![abhilash1in](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@abhilash1in](https://community.auth0.com/u/abhilash1in)\
**Post date:** [December 27, 2017, 12:19am UTC](https://community.auth0.com/t/multiple-welcome-emails-being-sent/9028/7 "2017-12-27T00:19:23Z")

</div>

@jmangelo Sure, thank you for looking into this! Please let me know if you need any more information. In fact, you can checkout the problem yourself. Try logging in multiple times at [https://birthdaytracker.goflo.in/login](https://birthdaytracker.goflo.in/login) using your Google account. You will get a welcome email every time.

---

<div class="post-metadata">

**Author:** ![abhilash1in](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@abhilash1in](https://community.auth0.com/u/abhilash1in)\
**Post date:** [December 27, 2017, 12:32am UTC](https://community.auth0.com/t/multiple-welcome-emails-being-sent/9028/8 "2017-12-27T00:32:46Z")

</div>

@jmangelo Thank you for the updated answer. I would like to point out that ~~I am able to see the correct `logins_count` field from the user profile of the users who have received multiple welcome emails. It is incremented correctly after every login.~~ (edit: that field exists only for some users, weird! ) Another thing I would like you to know is that, this problem of welcome email at each login is happening only to newer users. My older account is not receiving welcome emails with every login.

---

<div class="post-metadata">

**Author:** ![abhilash1in](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@abhilash1in](https://community.auth0.com/u/abhilash1in)\
**Post date:** [December 27, 2017, 12:50am UTC](https://community.auth0.com/t/multiple-welcome-emails-being-sent/9028/9 "2017-12-27T00:50:35Z")

</div>

@jmangelo there’s something weird going on. The same user is being shown twice, once with login count of 0 and other with login count of 4. However, clicking on both of them lead to the same user page (the user with Latest Login : 2 months ago)

Here’s the screenshot:

![alt text][1]

---

<div class="post-metadata">

**Author:** ![abhilash1in](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@abhilash1in](https://community.auth0.com/u/abhilash1in)\
**Post date:** [December 27, 2017, 12:54am UTC](https://community.auth0.com/t/multiple-welcome-emails-being-sent/9028/10 "2017-12-27T00:54:26Z")

</div>

Also, the count of `LOGINS` and `NEW SIGNUPS` on the dashboard is being shown as ZERO. PFA

![alt text][1]

---

<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:** [December 29, 2017, 9:24pm UTC](https://community.auth0.com/t/multiple-welcome-emails-being-sent/9028/11 "2017-12-29T21:24:33Z")

</div>

Based on the information I have the `logins_count` situation should already have been addressed and any new login will mean that the property will be added to the user profile. Have in mind that this may mean that some existing users may still get treated as first-time users for the next login where the count is started.

---

<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:** [December 29, 2017, 9:27pm UTC](https://community.auth0.com/t/multiple-welcome-emails-being-sent/9028/12 "2017-12-29T21:27:57Z")

</div>

The duplicate user situation may be a completely different situation; if that’s a test user where data loss is not an issue I would personally risk deleting it to see what would happen, but I will leave that decision to you. However, if the situation persists you raise that as separate question.

Also have in mind that the dashboard stats interface may still not be completely updated even though login count is now being correctly counted on individual users.

---

<div class="post-metadata">

**Author:** ![abhilash1in](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@abhilash1in](https://community.auth0.com/u/abhilash1in)\
**Post date:** [December 31, 2017, 12:14pm UTC](https://community.auth0.com/t/multiple-welcome-emails-being-sent/9028/13 "2017-12-31T12:14:27Z")

</div>

Thanks! The “multiple welcome emails” issue also seems to have been fixed as a consequence!

---

<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:57am UTC](https://community.auth0.com/t/multiple-welcome-emails-being-sent/9028/14 "2018-03-02T05:57:53Z")

</div>


