I am using firebase and want that whenever a new user is created the user gets an email for his/her new sign in. Just as on https://raw.githubusercontent.com/firebase/functions-samples/master/quickstarts/email-users/functions/index.js Whenever a new user sign ups something like this is logged in console with error.
Can someone tell where's my mistake?
Asked
Active
Viewed 489 times
0

Climb Tree
- 490
- 1
- 7
- 15
-
http://stackoverflow.com/questions/19877246/nodemailer-with-gmail-and-nodejs – Priyesh Kumar Apr 27 '17 at 13:42
-
Thanks @PriyeshKumar – Climb Tree Apr 28 '17 at 02:12
3 Answers
0
Have you configured the gmail.email and gmail.password environment variables as described in the example you linked? You would do this by running the following command in your terminal:
firebase functions:config:set gmail.email=your@email.com gmail.password=yourpassword

Incinerator
- 2,589
- 3
- 23
- 30
-
I have got solution to this question by just allowing less secure apps. – Climb Tree Apr 28 '17 at 02:12
0
This is what you want.
firebase.auth().onAuthStateChanged(function(user) {
user.sendEmailVerification();
});
If you want to check if email have verified try this code is recommended
firebase.auth().onAuthStateChanged(function(user) {
if (user.emailVerified) {
console.log('Email is verified');
}
else {
console.log('Email is not verified');
}
});

George C.
- 6,574
- 12
- 55
- 80
0
Allow less secure apps in your Google account from which you want to send mails. Suppose you are using your own personal email for sending emails through nodemailer. Just go to the link https://myaccount.google.com/lesssecureapps, and allow less secure apps. That's all you are ready to go. :) ;)

Climb Tree
- 490
- 1
- 7
- 15