Skip to content

feat: Send Welcome email on user signup #9

@archa8

Description

@archa8

Problem or Need

Currently, when a new user successfully registers for an account, the only feedback is a redirect to the dashboard. There is no official confirmation or welcome message sent to the user.

Proposed Solution

Implement an automated email service on the backend that sends a welcome email to a new user immediately after they successfully create an account.

Expected Behavior

  1. A new user fills out the registration form and submits it successfully.
  2. The user's account is created in the database.
  3. Simultaneously, the backend server sends an email to the address the user provided.
  4. The email has a clear subject line like "Welcome to Paisable!" and contains a friendly message confirming their account creation.

Benefits

  • Improved User Onboarding: Provides a professional and welcoming first impression, making the user feel valued from the start.
  • Increased Engagement: Reinforces the brand and encourages the user to begin using the application.
  • Implicit Email Validation: A successful email delivery provides a basic confirmation that the user has provided a valid, working email address.

Possible Implementation

  • Backend:
    • Install a Node.js email-sending library: npm install nodemailer.
    • Add email service credentials (e.g., for a Gmail "App Password") to the backend .env file (EMAIL_USER, EMAIL_PASS).
    • Create a reusable email service in a new file, backend/utils/sendEmail.js. This service will configure the Nodemailer "transporter" and contain the main logic for sending emails.
    • In the signup function within authController.js, after a user is successfully created, call the new sendEmail service to send the welcome email.

Alternatives Considered

  • No Email: This is the current behavior but provides a less professional experience.
  • Third-Party Services: For a production environment, a dedicated transactional email service like SendGrid or Mailgun would be a more robust alternative to Gmail. However, for a portfolio project and ease of setup, using Nodemailer with Gmail is an excellent and sufficient solution.

Additional Notes

  • The email sending process should not block the user registration response. It should be a "fire-and-forget" operation so that a failure in the email service does not prevent a user's account from being created.

Metadata

Metadata

Assignees

Labels

featureSuggest a new feature for the projecthacktoberfestIssues marked with this label are part of Hacktoberfest and open for contributions

Type

No type

Projects

Status

assigned

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions