Extends (JWT Auth) to send a personalized HTML welcome email on every successful signup.
| File | Change |
|---|---|
backend/utils/mailer.js |
NEW — Nodemailer transporter + sendWelcomeEmail() + HTML template |
backend/controllers/authController.js |
Calls sendWelcomeEmail() after user saved; email failure never crashes signup |
backend/package.json |
Added nodemailer dependency |
backend/.env |
Added MAIL_HOST, MAIL_PORT, MAIL_SECURE, MAIL_USER, MAIL_PASS |
Update MONGO_URI in backend/.env with your Atlas connection string.
OPTION A — Ethereal (free fake SMTP, no real emails, best for testing):
- Go to https://ethereal.email → click "Create Ethereal Account"
- Copy the credentials into .env: MAIL_HOST=smtp.ethereal.email MAIL_PORT=587 MAIL_SECURE=false MAIL_USER=xxxxx@ethereal.email MAIL_PASS=xxxxxxxxxxxx After signup, terminal prints a Preview URL to see the email in browser.
OPTION B — Gmail (sends real emails):
- Enable 2-Factor Auth on Google account
- Google Account → Security → App Passwords → generate one
- Use the 16-char app password (not your real Gmail password): MAIL_HOST=smtp.gmail.com MAIL_PORT=587 MAIL_SECURE=false MAIL_USER=yourgmail@gmail.com MAIL_PASS=abcd efgh ijkl mnop
cd AuthFlow/backend npm install npm run dev
cd AuthFlow/frontend npm install npm run dev