-
Notifications
You must be signed in to change notification settings - Fork 80
feat: add welcome email to be sent to new registering user #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: add welcome email to be sent to new registering user #78
Conversation
✅ Deploy Preview for paisable ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a welcome email feature to automatically send confirmation emails to new users after successful registration. The implementation uses a fire-and-forget approach to avoid blocking the registration process.
- Added email utility with SendGrid and SMTP fallback support
- Updated user registration to trigger welcome email sending
- Added necessary dependencies and documentation for email configuration
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| backend/utils/sendEmail.js | New email utility with SendGrid/SMTP support and welcome email template |
| backend/package.json | Added @sendgrid/mail and nodemailer dependencies |
| backend/controllers/authController.js | Updated signup function to send welcome email after user creation |
| README.md | Added email configuration documentation |
Files not reviewed (1)
- backend/package-lock.json: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| transport.verify() | ||
| .then(() => console.info("SMTP transporter verified")) | ||
| .catch(err => console.warn("SMTP transporter verification failed", { message: err.message })); | ||
|
|
||
| sendRaw = async ({ to, from, subject, text, html }) => { | ||
| try { |
Copilot
AI
Oct 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SMTP transporter verification is executed asynchronously at module load time without awaiting completion. This could lead to race conditions where sendRaw attempts to use an unverified transporter. Consider moving this verification inside sendRaw or making it a blocking operation during initialization.
| transport.verify() | |
| .then(() => console.info("SMTP transporter verified")) | |
| .catch(err => console.warn("SMTP transporter verification failed", { message: err.message })); | |
| sendRaw = async ({ to, from, subject, text, html }) => { | |
| try { | |
| // Ensure transporter is verified before sending emails | |
| let smtpVerified = false; | |
| let smtpVerifyPromise = null; | |
| sendRaw = async ({ to, from, subject, text, html }) => { | |
| try { | |
| // Verify transporter once before first send | |
| if (!smtpVerified) { | |
| if (!smtpVerifyPromise) { | |
| smtpVerifyPromise = transport.verify() | |
| .then(() => { | |
| smtpVerified = true; | |
| console.info("SMTP transporter verified"); | |
| }) | |
| .catch(err => { | |
| console.warn("SMTP transporter verification failed", { message: err.message }); | |
| throw err; | |
| }); | |
| } | |
| await smtpVerifyPromise; | |
| } |
| } catch (err) { | ||
| console.error("SendGrid email failed", { to, subject, message: err.message }); | ||
| } |
Copilot
AI
Oct 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sendRaw function for SendGrid catches errors but doesn't re-throw them, causing the function to return undefined instead of propagating the error. This makes error handling inconsistent with the caller's expectations in sendWelcomeEmail.
| } catch (err) { | ||
| console.error("SMTP email failed", { to, subject, message: err.message }); | ||
| } |
Copilot
AI
Oct 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sendRaw function for SMTP catches errors but doesn't re-throw them, causing the function to return undefined instead of propagating the error. This makes error handling inconsistent with the caller's expectations in sendWelcomeEmail.
|
Kindly cross-link the corresponding issue. Thanks! |
|
I linked my PR with the issue, please Re-review |
|
@archa8 Please merge it. |
|
@onipinaka There are some conflicts right now. Kindly pull the recent changes and resolve the conflicts as pointed out by Git. |

Description
This PR adds a welcome email feature to the Paisable application. Now, when a new user successfully registers, the backend automatically sends a friendly welcome email confirming their account creation. The email is sent using either SendGrid (if configured) or Gmail SMTP as a fallback.
Related Issue:
fixes #9
The email sending is implemented as a fire-and-forget operation, meaning it does not block or delay the user registration process. Any failures in the email service are logged, but the user account is still created and the API response is returned immediately.
Changes include:
sendEmail.jsutility inbackend/utils/to handle email sending.signupfunction inauthController.jsto callsendWelcomeEmailafter successful account creation..env.Related Issue
Fixes #
Motivation and Context
Previously, when a new user registered, there was no confirmation or onboarding email, which could make the app feel less professional and reduce user engagement. This feature:
Types of Changes
How Has This Been Tested?
Screenshots (if applicable):
Checklist